Read data from Access MDB file?

Read data from Access MDB file?

am 04.04.2008 23:54:01 von martin

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
computer.

Are there any alternatives?

Thanks.

Re: Read data from Access MDB file?

am 05.04.2008 02:17:51 von Csaba

"Martin" wrote in message
news:gn8dv3t74hss7473kt1kf6cloaqkkhjbfq@4ax.com...
> 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
> computer.
>
> Are there any alternatives?
>
> Thanks.

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.

http://support.microsoft.com/kb/253580/EN-US/

Richard.

Re: Read data from Access MDB file?

am 05.04.2008 02:20:05 von Csaba

"Richard" wrote in message
news:47f6c534$0$3038$dbd43001@news.euronet.nl...
>
> "Martin" wrote in message
> news:gn8dv3t74hss7473kt1kf6cloaqkkhjbfq@4ax.com...
>> 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
>> computer.
>>
>> Are there any alternatives?
>>
>> Thanks.
>
> 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.
>
> http://support.microsoft.com/kb/253580/EN-US/
>
> Richard.
>
>

Oops....
the link should have been:

http://support.microsoft.com/kb/166029/

R.

Re: Read data from Access MDB file?

am 05.04.2008 02:29:03 von Charles Calvert

On Fri, 04 Apr 2008 14:54:01 -0700, Martin
wrote in :

>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?

[snip]

>Are there any alternatives?

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.

On Fri, 08 Feb 2008 14:05:25 -0700, Jack
wrote in :

>In a PHP script, I'm using a DSN-less ODBC connection to connect to an
>MS Access database. Like so:
>
>$DBConn = 'Driver={Microsoft Access Driver (*.mdb)};
>DBQ=c:\path\to\MyDatabase.MDB';
>$conn = odbc_connect($DBConn,'','');
>
>This works fine - no problems.
>
>Now, I want to connect to an Access database that is on another
>computer (on a LAN). Using a similar statement:
>
>$DBConn = 'Driver={Microsoft Access Driver (*.mdb)};
>DBQ=\\ComputerName\c\path\to\MyDatabase.MDB';
>$conn = odbc_connect($DBConn,'','');
>
>But this results in an error:
>
>SQL error: [Microsoft][ODBC Microsoft Access Driver]General error
>Unable to open registry key 'Temporary (volatile) Jet DSN for process
>0xe80 Thread 0x8a8 DBC 0xf8e024'...

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
http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research

Re: Read data from Access MDB file?

am 06.04.2008 13:56:11 von colin.mckinnon

On 4 Apr, 22:54, Martin wrote:
> 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
> computer.
>
> Are there any alternatives?
>
> Thanks.

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.

C.
(recovering MS Access programmer)

Re: Read data from Access MDB file?

am 07.04.2008 04:03:04 von martin

On Sat, 5 Apr 2008 02:17:51 +0200, "Richard" wrote:

>
>"Martin" wrote in message
>news:gn8dv3t74hss7473kt1kf6cloaqkkhjbfq@4ax.com...
>> 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
>> computer.
>>
>> Are there any alternatives?
>>
>> Thanks.
>
>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.
>
>http://support.microsoft.com/kb/253580/EN-US/
>
>Richard.
>

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
machine.

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.