Adding the PDO ODBC extension


#1

I need to connect to an Access database that has been uploaded to the server.

I believe I need to enable the PDO_ODBC.so extension as it does not appear in phpInfo()

I looked in /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226 where the other extensions were found but could not find the ODBC one. Is it somewhere else? Do I need to download it and add it to this folder?


#2

Enabling that extension won’t help you here. At least, not without a bunch of extra work.

The PDO ODBC driver cannot be used to connect to databases directly. Instead, it’s a sort of “wrapper” for other ODBC drivers. (For instance, if you had an ODBC driver for MySQL, you could use that with PDO ODBC to connect to a MySQL server. Which would be silly, but whatever.)

Anyways, as far as I know, there is no free ODBC driver available to connect to Access databases. There is a commercial one out there, but it’s rather expensive; unless you have a really pressing business need, you’re probably better off putting your time towards converting this database to use MySQL or SQLite.


#3

So I have tons of databases I want to open. I cannot convert them since they are used by another program as .mdb’s. I want to keep the same file and connect to it from both the webapp and this existing program.

Based on your response my options are:
1.) Write some code to convert the mdb to MYSQL when it is uploaded and then convert back to mdb when done. (this seems unlikely)
2.) Buy the commercial odbc driver (what is it called?)
3.) Whatever “At least, not without a bunch of extra work.” means

bummer.
[hr]
It seems easy. Why doesn’t something like this work? http://www.sanwebe.com/2011/08/microsoft-access-using-php-pdo


#4

The commercial Access ODBC driver I’m aware of is written by Easysoft. A single-server license is £499 (about $750 USD at current exchange rates); installing it, getting it working, and purchasing it is the extra work I was referring to. Here’s a link: http://www.easysoft.com/products/data_access/odbc-access-driver/

(Obligatory disclaimer: DreamHost has no business relationship with Easysoft, and I’ve never used this software.)

The approach described in your link depends on having Microsoft Access installed on the system to provide an ODBC driver. As such, it won’t work on a Linux server.


#5

Doh, I forgot I was working with Linux. Thanks for the guidance going forward.