I’m trying to create a simple connection using PDO (on localhost – xampp):
<?php try{ // Connect //$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=.dbicr.accdb;Uid=Admin"); $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:xampphtdocsbddbicr.accdb;Uid=Admin"); /*** The SQL SELECT statement ***/ $sql = "SELECT * FROM Miasta"; foreach ($dbh->query($sql) as $row) { print $row['Nazwa'] .' - '. $row['IDWojewództwa'] . '<br />'; } /*** close the database connection ***/ $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); } ?>
But then I get this error:
SQLSTATE[HY000] SQLDriverConnect: 63 [Microsoft][Driver ODBC Microsoft Access]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x5f8 Thread 0x1124 DBC 0x3608134 Jet.
any ideas?
Advertisement
Answer
Thanks a lot vodich, here is solution:
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\xampp\htdocs\bd\db\icr.accdb;Uid=Admin");