Connecting PHP to MS Access
<p>I am currently struggling with connecting to a MS Access database using PHP. I have checked other relevant related posts trying to get aid but to no success. 
I am running windows 7 and attempting to connect to (.mdb database) </p>

<p>I have done the following trying to resolve this:</p>

<ol>
<li>I have uncommented/enabled extension=php_pdo_odbc.dll in the php.ini
file</li>
<li>I have re-installed AccessDatabaseEngine.exe but still I am not getting any joy.</li>
<li>I have tried using the 32bit Windows ODBC connector (C:\Windows\System32\odbcad32.exe) as well as the 64 bit version
(C:\Windows\SysWOW64) version I am still not getting joy</li>
<li>I have also tried creating a custom drivers and including it in the code bust still no joy</li>
</ol>

<p>Please see the code below: </p>

<pre><code>try {
    $conn=new PDO('odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=$this-&gt;$dbName;Uid=$this-&gt;$Uid;Pwd=$this-&gt;$Upass');
    }
    catch(PDOException $e)
    {
    echo "Connection failed: " . $e-&gt;getMessage();
    }
</code></pre>

<p>I have created a custom driver called Microsoft Access: </p>

<pre><code>try {
    $conn=new PDO('odbc:DRIVER={Microsoft Access};DBQ=$this-&gt;$dbName;Uid=$this-&gt;$Uid;Pwd=$this-&gt;$Upass');
    }
    catch(PDOException $e)
    {
    echo "Connection failed: " . $e-&gt;getMessage();
    }
</code></pre>

<p>I get this output all the time: </p>

<pre><code>SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
</code></pre>