Accessing an Access Database

  • Thread starter Thread starter Russell Read [MSFT]
  • Start date Start date
R

Russell Read [MSFT]

Hi all,

I am using VB script in ASP to access a MS Access database. This works fine
until I want to access the same db placed on a file share.

The code I am using is...

'create connection object
Set db = Server.CreateObject("ADODB.Connection")
'specify the database provider
db.Provider = "Microsoft.Jet.OLEDB.4.0"

'declare the location of the database
db.ConnectionString = "Data Source=\\fileshare\directory\database.mdb"

I get an error to the effect...

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

I guess this is because the remote file share can't authenticate me as the
effective user of the page is anonymous.

Does anybody know how I would be able to get this to work?

N.B The users who are using the website will be logging onto the same domain
that the file share is on and the file share has the correct permissions set
for the users that need access.

-Cheers, Russell.
 
Try creating a DSN configured to access the database with an account with
sufficient privileges.
Then change your connection string to;

db.ConnectionString = "DSN=YourDSNName"

Let us know if that works
 
Hi George,

Thanks for the info - however it didn't work :(

I created a System DSN on the server and pointed it to the Access db on the
file share. This created OK and to test it I opened Excel and populated a
Pivot Table with the data just to check the DSN was working properly - this
all worked fine.

I then changed the code I had so that it was just...

Set db = Server.CreateObject("ADODB.Connection")
db.ConnectionString = "DSN=myDSNshare"

....and when I try and load the page, after a while I get the error

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[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.

Can you think of anything else I could try?

-Cheers, Russell.




George Durzi said:
Try creating a DSN configured to access the database with an account with
sufficient privileges.
Then change your connection string to;

db.ConnectionString = "DSN=YourDSNName"

Let us know if that works

Russell Read said:
Hi all,

I am using VB script in ASP to access a MS Access database. This works fine
until I want to access the same db placed on a file share.

The code I am using is...

'create connection object
Set db = Server.CreateObject("ADODB.Connection")
'specify the database provider
db.Provider = "Microsoft.Jet.OLEDB.4.0"

'declare the location of the database
db.ConnectionString = "Data Source=\\fileshare\directory\database.mdb"

I get an error to the effect...

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

I guess this is because the remote file share can't authenticate me as the
effective user of the page is anonymous.

Does anybody know how I would be able to get this to work?

N.B The users who are using the website will be logging onto the same domain
that the file share is on and the file share has the correct permissions set
for the users that need access.

-Cheers, Russell.
 
Back
Top