PDO: How to access Microsoft Access file on Linux?

linux, ms-access-2007, odbc, pdo, php

Solution

you should install the MDB driver.

I have no way to try it now, but I think that MDB Tools (specifically the ODBC driver) can do what you' re interested to.

Problem

I have managed to read data of Microsoft Access file (.accdb) on Windows using PDO but I'm having problem getting to work on Linux (CentOS). I can see modules is installed: ``` [root@rapid host]# php -m | grep PDO PDO PDO_ODBC [root@rapid host]# php -m | grep odbc odbc ``` code: ``` <?php try{ $dbhAccess = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=/root/access/data.accdb;Uid=Admin"); } catch(PDOException $e){ echo $e->getMessage(); exit(); } ``` I get an erro when I execute (CLI) PHP file: ``` [root@rapid host]# php access.php SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified ```

Original source