SQLSTATE[IM002] sqldriverconnect:0 Solution Ideas

Source: Internet
Author: User
Tags driver manager odbc connection
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
------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.



  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.