• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 678
  • Last Modified:

PHP to MS Access odbc connection error

Hi there,

I have been looking for a solution to my problem of which I have found a few threads here and elsewhere regarding the DSN connection problem when attempting to connect php to an access database residing on a netwrok drive.

It works perfectly when the database is stored locally but not when I am trying to contact the main database on the share. Tried the DSN less approach too but to no avail. I assume it might be permissions but some help would be much appreciated.

THank you
0
databarracks
Asked:
databarracks
  • 10
  • 4
1 Solution
 
TonyRebaCommented:
Make sure you can connect and have access to the database in the hosting computer .
0
 
databarracksAuthor Commented:
I do have full read/write permissions to the Access Database and everything else within that drive? I make regular changes in the backend database?
0
 
databarracksAuthor Commented:
Are there other permission I might require perhaps?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
TonyRebaCommented:
what is the php error you are getting?
0
 
databarracksAuthor Commented:
( ! ) Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data., SQL state S1000 in SQLConnect in C:\wamp\www\test\ds_system.php on line 5
0
 
databarracksAuthor Commented:
Nobody else has this file open and no laccdb files exist.
0
 
TonyRebaCommented:
Try something like:

$db = ADONewConnection('access');
$dsn =
  "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\inetpub\adodb\northwind.mdb;Uid=Admin;Pwd=;";
$db->Connect($dsn);

0
 
databarracksAuthor Commented:
Ok I tried that and go this error:

( ! ) Fatal error: Call to undefined function ADONewConnection() in C:\wamp\www\test\ds_system.php on line 5

Line 5 being $db = ADONewConnection('access');
0
 
TonyRebaCommented:
Make sure you have  access to the share drive folder where the  *.accdb or mdb file physically resides. (read, write access to the folder) for the System account that is configured

And Restart

0
 
databarracksAuthor Commented:
Yes I do, still no luck
0
 
databarracksAuthor Commented:
Hi there do you have any further suggestions?
0
 
databarracksAuthor Commented:
How can make Apache-Service run with a Domain (network)-User, as this might be the issue perhaps?
0
 
NoiSCommented:
I guess that your trouble is that the Apache runs under a user wich don't have permissions to open a file on the network.
One solution is to share the directory with permissions to "everyone" and map this dir on computer where Apache is running, so you can try read it like a local file.
Another is to use PHP_FPM (http://php-fpm.org/) to run some scripts under another user to avoid problems of network permissions.

0
 
databarracksAuthor Commented:
Hi there, I think you have nailed it there. I have done this and it seems to be working just fine. Many thanks for your response you have been most helpful.
0
 
databarracksAuthor Commented:
Very good advice
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 10
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now