Read data from Access MDB file?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
From a PHP script, is there any way to retrieve data from an MS Access
database that's located on another computer (on a LAN) other than by
using ODBC?

I posted a question here a couple of weeks ago about the problems I
was having trying to do this via ODBC. I stated then that I was giving
up trying to get it to work but I didn't. I foolishly have spent quite
a few more hours in a futile attempt to get this to work. Now I'm to a
point where I don't know anything further to try.

No, I don't have the option of switching to a different database
format. The data I need to read is in MS Access MDB files and that's
not going to change.

I don't have a problem reading an MDB file when it's on the same
computer that my PHP script is running on but the whole idea of what
I'm trying to do is to read from a file that's located on a different

Are there any alternatives?


Re: Read data from Access MDB file?

Quoted text here. Click to load it

Hello again,

I just got back to checking how my setup was.... and after some
fiddling I got it to work again.
My mdb file is on a remote share, and I use an UNC path.

The trick is this:
Your webserver / PHP combo need access to the file.
That means it needs a valid local user account on the remote computer.

Check what the user account of your webserver is, and create that
account on the remote computer.
Or: change the user the webserver is running under.
Whatever is easiest.

I found a nice doc about it here, it wasnt hard to find though....
surprised me you missed it.


Re: Read data from Access MDB file?

Quoted text here. Click to load it

the link should have been:


Re: Read data from Access MDB file?

Quoted text here. Click to load it

Hi, Richard - Thanks for the response.

I had not come across the specific document you referenced but I did
find many similar ones. Also, your links are specifically saying
they're for ASP users. I don't know if such resolutions are applicable
to ODBC situations. In my Googling, I've tended to skip over
ASP-oriented stuff.

Basically, what I been trying to do, is establish permissions and
accounts on both computers. And have been totally un-successful.

The 2nd link you gave actually doesn't give any resolution to the
problem that I can see; but it does reference your 1st link. So, I
have printed that out (article id 253580) and am trying to interpret
what it says. But, as I read it, it's telling me to do what I've
already been trying to do.

The article (253580) starts off in a typically confusing manner
talking about "IIS Anonymous Authentication" and concludes the
paragraph by stating that it is "... for Domains under Microsoft
Windows NT 4.0." Well, I'm not dealing with Windows NT 4 - both
computers are Windows XP Pro. So, does this explanation apply to XP? I
can't tell from the way it's written.

I think that I have the "permissions" issues resolved. I have the
"temp" folder on both machines set such that "Everybody" has full
control. I have the folder where the MDB file is on the remote machine
configured similarly.

Where I think the problem is, is with the user account on the remote

One of the main things that I tried to do over the last several days
was to set up a "User" on the remote machine that ODBC could use when
it tries to connect to the MDB file. One of the things I read said to
set-up a IUSR_MachineName account on the remote machine with all the
needed rights to access the MDB file (where IUSR_MachineName is the
same as the one on the IIS server). I did this (I think) and was
totally unsuccessful in getting anything to work any differently.

Now, it is quite probable that I have not done this correctly. But, I
have been unable to find any step-by-step instructions on how to do
this. Is there any possibility that you (or someone) could provide
some specific instructions (that apply in a Windows XP Pro / IIS /
ODBC environment)?

Again, thanks for the response and for having the patience to continue
trying to help me on this issue. It's greatly appreciated.

Re: Read data from Access MDB file?

Quoted text here. Click to load it


Quoted text here. Click to load it

Can you use COM objects in PHP via a module of some sort?  If so, then
you could use ADO and the OLEDB driver instead of the ODBC driver.

Quoted text here. Click to load it

I did some googling and came up with the following list:

1. Have you checked the path by pasting it into Start -> Run or
something similar to verify that the file is opened?

2. What user is php running under?  Does that user have network
privileges and privileges to the share where the file resides?  See
< .

Also see: < .
Charles Calvert             |  Software Design/Development
Celtic Wolf, Inc.           |  Project Management |  Technical Writing
(703) 580-0210              |  Research

Re: Read data from Access MDB file?

Quoted text here. Click to load it

Assuming you can actually sort out the problems of connecting to a
remote Access database AND you get record locking working properly
(highly improbable IMHO) then you've just set yourself up for a world
of pain in supporting the application.

This is *so* not the way to solve the problem. There are so many other
things you could do. Sufice to say that you absolutely must get the
data into a proper multi-user DBMS before accessing it. Whether you do
it by linking the tables back to the MDB file of replicate the data
from the MDB file into the database (MSAccess was specifically
designed around this eventuality) is to you - and you will still have
problems as a result. But a lot less than trying to use an MDB file as
a proper DBMS.

(recovering MS Access programmer)

Site Timeline