Connect to access with php
January 9, 2012 6:51 AM   Subscribe

How do I connect, dsn-free, to a passworded Access (.mdb) database with php (5.2.4)? Google throws up lots of methods - none seem to work.
posted by monkey closet to Computers & Internet (5 answers total) 1 user marked this as a favorite
Can you export the data to a more sensible format -- perhaps to csv, perhaps to a sqlite database -- and then access that from php?
posted by faustdick at 7:17 AM on January 9, 2012

What version of Access is the mdb file?

A key part of connecting to a file system database is that the permissions are right. Make sure they are set for read and write. And what OS is your server?
posted by artlung at 7:43 AM on January 9, 2012

It's an old Access file - 2000 at the latest. It's huge and needs to be password protected. I've had no joy with conversion, which is why I'm trying this as an interim fix.

Apache server. Not sure what OS.

My only access to the server is ftp
posted by monkey closet at 7:50 AM on January 9, 2012

And when you connect, what errors do you get?

And you have set permissive read and write permissions on the file?

One of the security aspects of having your database file on the webserver is that it may be browsable if someone knows the path. Take caution that you're not doing that.
posted by artlung at 9:55 AM on January 9, 2012

Update - ended up working on faustdick's suggestion, but the export didn't handle escaping properly and ended up with a lot of bad data.

Finally solved the problem by putting php on a local (Windows) machine to read the database, and then using it to output a series of giant sql queries that I could use to build a new mysql database on the server. I'm sure there's a quicker way, but I couldn't find it...
posted by monkey closet at 4:15 AM on January 16, 2012

« Older What happens to children when a solo parent has an...   |   Running out of $$$... line of credit? Newer »
This thread is closed to new comments.