Accessing an Access Database

  • Thread starter Russell Read [MSFT]
  • 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.
 
G

George Durzi

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
 
R

Russell Read [MSFT]

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.
 
Joined
Jul 18, 2006
Messages
1
Reaction score
0
I was having the same issue. I'm in the process of moving several websites from an old NT 4 server to Windows 2003 server. And I have a database that is being accessed via ASP that resides on a different server. To fix the issue I did everything listed in the following article (except for the web.config file changes as the website is not an ASP.NET site, but a classic site), and it worked.

http://support.microsoft.com/default.aspx?scid=kb;en-us;307901#4c

Let me know if you still have problems and I can walk you through the process.

Alicia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top