laravel-db2 icon indicating copy to clipboard operation
laravel-db2 copied to clipboard

PDOException could not find driver

Open devharshindia opened this issue 3 years ago • 4 comments

Hi, I am getting this error. I have already enabled pdo drivers in php extensions. Also in installation steps queue configuration is a little confusing. Can you please add the dummy code in the steps so that it becomes easier for newbies like me to update the configuration correctly?

devharshindia avatar Jul 30 '21 06:07 devharshindia

for a few days i have been trying to set up a db 2 connection with laravel without success. I have yet installed the ibm driver. I manage to connect with odbc_connect outside of laravel. can you please do a tutorial. thanks in advance

ibrahpremier avatar Jul 30 '21 18:07 ibrahpremier

for a few days i have been trying to set up a db 2 connection with laravel without success. I have yet installed the ibm driver. I manage to connect with odbc_connect outside of laravel. can you please do a tutorial. thanks in advance

Hi, can you please share the details on how do created a odbc_connect connection outside of laravel.

devharshindia avatar Jul 31 '21 05:07 devharshindia

` class MyClass { private $server = "Driver={Client Access ODBC Driver (32-bit)};System=SERVER_ADDRESS;"; #the name of the iSeries private $user = USERNAME; #a valid username that will connect to the DB private $pass = PASSWORD; #a password for the username

public function connect()
{
    $dbConnection = odbc_connect($this->server, $this->user, $this->pass);
    return $dbConnection;
}


public function request()   
{
    $db = $this->connect();
    $req1 = " select * FROM DATABASE.TABLE";
    $stmt = odbc_exec($db, $req1);
    
    $row = odbc_fetch_array($stmt);
    echo json_encode($row);
    
    odbc_close($db);
}

}

$st = new MyClass(); $st->request(); ` This work for me outside of Laravel

ibrahpremier avatar Jul 31 '21 13:07 ibrahpremier

Do we have any solution?

mauriciolanner avatar Apr 07 '22 21:04 mauriciolanner