SQLSTATE[IM002] Sqldriverconnect:0
conn.php
try {
$conn = new PDO ("Odbc:driver={microsoft Access Driver (*.mdb)};D bq=". Realpath (". /data/data.mdb "));
} catch (Pdoexception $e) {
Echo ' Connection failed: '. $e->getmessage ();
}
?>
Error notification after running
Connection failed:sqlstate[im002] sqldriverconnect:0 [MICROSOFT][ODBC Driver Manager] Data source name not found and default driver not specified
Baidu Google search long time also do not know where to set a problem, Php_pdo_odbc.dll has enabled, Phpinfo () also display support PDO/ODBC, MDB file path is also correct
The system is WIN7SP1 x64
PHP is 5.5.7 VC11 x64 Thread Safe
Apache is HTTPD-2.4.7-WIN64-VC11.
Office is Office2010 x64
Connecting to the MySQL database with PDO is normal, but connecting the MDB makes a mistake, is it not where I set the wrong, or where I need to install or set what driver
Share to: more
------Solution--------------------
It seems that the database does not support access, the new ACCDB format, you can use the ACE to connect to try it
http://www.microsoft.com/en-us/download/details.aspx?id=13255
------Solution--------------------
Code is fine, check to see if the COM extension is loading
Extension=php_com_dotnet.dll
Starting with php5.4, PHP for Windows no longer loads COM extensions by default and needs to be configured
You're using an ODBC connection string, not an ODBC data source
So PDO needs to be able to construct the data source through COM
------Solution--------------------
Echo Realpath (".. /data/data.mdb ");
Look what it is.
Your connection string is definitely not a problem for Access2003.
However, it is possible for Access2010, because there is no test
Try adding a uid=admin.