Hello,

I am having issue connecting my Access database to my PHP site via ODBC. Here is what I am doing:

   <?php $dbName = "F:\Data\Web\_Home\TickSys\TickSys.accdb";
        if (!file_exists($dbName)) {
            die("Could not find database file."); }
        print "Found DB File."; 
        $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=$dbName; Uid=; Pwd=;"); ?>

The error I receive is:

    Found DB File. Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IM002] SQLDriverConnect:
        0 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified' in 
        F:\Data\Web\_Home\TickSys\index.php:20 Stack trace: #0 F:\Data\Web\_Home\TickSys\index.php(20): 
        PDO->__construct('odbc:DRIVER={Mi...') #1 {main} thrown in F:\Data\Web\_Home\TickSys\index.php on line 20

What I have tried:
-Researched the error I got and [MSDN says](http://msdn.microsoft.com/en-us/library/ms715433%28v=vs.85%29.aspx) "IM002 - Data Source Not Found and No Default Driver Specified"
-I have downloaded and installed the "[Microsoft Access Database Engine 2010 Redistributable](http://www.microsoft.com/en-us/download/details.aspx?id=13255)" from Microsoft
-I have setup the Data Source Name in ODBC under the System DSN pointing to my Access database file
-I went into the php.ini file and ADDED the line extension=php_pdo_odbc.dll, I added this because from what I saw


Additional Info from phpinfo:
-running PHP 5.3.28
         PDO drivers mysql, sqlite, odbc
         Client API version mysqlnd 5.0.8-dev
         ODBC Connection Pooling Enabled, strict matching

I feel like the error is related to me not having the "extension=php_pdo_odbc.dll" line in php.ini by default, but I am really unsure what to do/try at this point.
Any and all advice/help/comments are very appreciated.

Sorry for posting my whole text in the code snippet format but I was having trouble getting my post to be submitted because it kept saying I had an error with my formatting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.