Error: Could Not Find Driver - Using Pdo With Ms Access Database
Background: I've got a fully working Microsoft Access DB. I've made a database connection class and just a simple page that includes the class and fires off a simple SQL code. I kn
Solution 1:
Manipulating an Access database from PHP via ODBC has some serious limitations that affect both PDO and the older odbc_exec methods. If you are using a Windows server and you absolutely must use an Access database back-end (which is strongly discouraged) I would recommend that you use ADO under com_dotnet like this:
<?php// this code requires the following php.ini directive://// extension=php_com_dotnet.dll$con = new COM("ADODB.Connection");
$con->Open(
"Provider=Microsoft.Jet.OLEDB.4.0;" .
"Data Source=C:\\Users\\Public\\mdbTest.mdb");
$rst = new COM("ADODB.Recordset");
$rst->Open("SELECT * FROM celebs", $con, 1, 3); // adOpenKeyset, adLockOptimisticwhile (!$rst->EOF) {
echo$rst["firstname"]->Value . " " . $rst["surname"]->Value . "<br/>";
$rst->MoveNext;
}
$rst->Close();
$con->Close();
This is especially true if you ever need full Unicode character support or expect to be manipulating binary objects.
Post a Comment for "Error: Could Not Find Driver - Using Pdo With Ms Access Database"