Jump to content

Can't connect to network Access database


s3rvant

Recommended Posts

I've been searching Google and trying various methods to connect to a networked Access database all day... no luck.

 

I'm running Xampp Lite v.1.7.2 which runs Apache v.2.2.12 and PHP v.5.3.0 on Win XP.

 

I'm trying to use odbc_connect to connect to a access database I have on the network, but I keep getting the error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLConnect in C:\xampplite-1.7.2\htdocs\colormeter.php on line 4

 

The code I'm currently using is:

$db = '\\\\Servername\\Path\\Database.mdb';
$odbc_driver = 'driver={microsoft access driver (*.mdb)};dbq='.$db;
$conn = odbc_connect($odbc_driver,'','');

 

The network path has full permissions to everyone, but I've still tried to use both my local machine's username as well as my domain username, both with same error. I've tried using a COM connection with ADO, but it also fails. I've tried adding the database as a system DSN to no avail. With the DSN I had read that while Windows forces you to map the drive, you cannot use drive letters that way, so I went into the registery and changed to the path to the appropriate \\Server\file type path. Still no luck. I've also tried making connections to databases in other network shares, same error.

 

This code works great with a local database. I can connect and query local databases just fine. I only have trouble when it's on the network.

Link to comment
Share on other sites

On another note, when I set the database as a DSN and alter the registry to use the \\Server\\file path type, I also tried to make the Apache service use a domain user account, but the service wouldn't start that way. Not sure why I couldn't get the service to start, but I've seen more then one user say that they were able to use a domain account with the service and that it enabled the code I gave above to work.

Link to comment
Share on other sites

  • 2 months later...

  The answers I've run across vary, I am confused about this:

  Sample Code:

 

$db = '\\\\Servername\\Path\\Database.mdb';

 

  Is it really 4 'back-slashes' before 'server name', then 2 in-between , as shown?  I did revised the 'odbc dsn' setup in the registry as a few tips had suggested, been a while since I dealt with 'UNC paths, etc.' so I'm trying to recall the proper syntax.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.