March 9th, 2010, 12:39 PM
Access Database on Linux
I'm trying to write a script to do the bulk of my work for me. What I want to do is go through a loop and select records based on loop control variable states. Unfortunately the database I have to use is an MS Access MDB file. I've been reading around and found a link to PHP documentation[below]. What I read in this was that if you have PHP on a Windows BOX you already have the ODBC drivers required to make the database connection. If you're on a *nix box you will need unixODBC drivers from openlink[not open source]. But it also goes on to say that this will allow you to connect from a Linux box to an MDB on a Windows box. What I really want to do is connect to the MDB on the local Linux box. Is this possible?
PHP Access Database Docs:
P.S. This is the best place I found to put the thread.
Last edited by acidfourtyfive; March 9th, 2010 at 12:43 PM.
March 9th, 2010, 01:25 PM
To the best of my knowledge, no. The mdb has to live on a windows computer. I don't know if there is any solution using wine though.
Comments on this post
I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
March 12th, 2010, 09:28 AM
I have found some people saying they have gotten access to an Access Database located on a Linux box using combinations of various software. The most popular seems to be MDBTools (MDB Driver) and unixODBC (ODBC Driver?). Anyway, I'm still fighting with it but I'm to the point now that I'm getting PHP errors that show my lack of knowledge of what I'm going.
I will keep looking but the only information I can relly find is in regards to other database configurations. I found something at bryanmills.net but I can't seem to get it working due to the lack of a PHP function: odbc_connect.
Originally Posted by PHP Error
March 12th, 2010, 01:00 PM
I have successfully read a MDB file using PHP on a Linux box without any Windows machines...except to copy the MDB file from when I started this project
Anyway, I used this as a guide:
I found it via google but the link on google wasn't available so I used the google cache and then went to bryanmills.net to search using their search engine and found the article again. Here is the guide. I had to rebuild PHP with the --with-unixODBC=shared,/usr/lib. I also didn't use the RMPs but go source tarballs of the same version for MDBTools and unixODBC. I have used the sample script with minor changes to read from an Access 97 database successfully.
That being said, the versions mentioned in the guide had a few issues for compiling but when I tried the RPMs - which i initially installed and figured was my issue so uninstalled them - they worked fine, as in I was getting the same errors from PHP that required me to rebuild PHP. The changes in the source, for MDBTools, are minor like adding a C function prototype definition and changing a function type from extern to static. The forums for the various softwares have these documented as I have made sure that all of my findings were available in the forum by me or someone else. There is also one change where there is an illegal switch in C source so adding the proper breaks solves this. Again, it's all mentioned in the forums. MDBTools seems to be in the process of being converted to Java but the last release, which I didn't use because it didn't have everything I needed from what I could tell, is 4 years old.
Originally Posted by BryanMills.net
Last edited by acidfourtyfive; March 12th, 2010 at 01:07 PM.