Error opening connection to Access (Jet) DB

B

Burton Roberts

When using ASP.NET and an OleDBConnection control I get this error on
CNN.Open:

"The Microsoft Jet database engine cannot open the file
'C:\A2K\Backups\EdsBe2K.mdb'. It is already opened exclusively by another
user, or you need permission to view its data."

I have tried using a connection string, too, to no avail.

However, when I am in Windows Forms I have no problem opening the same file
using a connection control or connection string. There's no security on the
EdsBe2K.mdb file.

Thanks
 
S

Steve C. Orr [MVP, MCSD]

The most likely cause of this problem is the default ASPNET user account not
having permission to access that folder.
Grant the user account access or use Impersonation to have it run under
another user account that does have permission.
For testing purposes you can have it run under your personal user account
since that is what's probably being used successfully in your successful
WinForms test.
Here's more info:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 
B

Burton Roberts

Thanks!


Steve C. Orr said:
The most likely cause of this problem is the default ASPNET user account
not having permission to access that folder.
Grant the user account access or use Impersonation to have it run under
another user account that does have permission.
For testing purposes you can have it run under your personal user account
since that is what's probably being used successfully in your successful
WinForms test.
Here's more info:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 
K

Ken Cox [Microsoft MVP]

Hi Burton,

Make sure the current user (e.g., ASPNET account) has sufficient permissions
(Change) in the directory where the .mdb file is located.

Access needs to open a locking (.ldb) file, so more than just read
permission is required.

Let us know if this gets you moving?

Ken
Microsoft MVP [ASP.NET]
 
B

Burton Roberts

Hi, Ken
It's working. But I think this had to do with the oledb connection control
on the design surface. When I deleted it and used the string everything
worked, but I had to delete the connection control, or so it seemed. Then I
put the connection control back in, just to see, but everything still
worked. So I'm not sure why it's working now. But I didn't touch the
permissions in the folder.
Thanks

Ken Cox said:
Hi Burton,

Make sure the current user (e.g., ASPNET account) has sufficient
permissions (Change) in the directory where the .mdb file is located.

Access needs to open a locking (.ldb) file, so more than just read
permission is required.

Let us know if this gets you moving?

Ken
Microsoft MVP [ASP.NET]

Burton Roberts said:
When using ASP.NET and an OleDBConnection control I get this error on
CNN.Open:

"The Microsoft Jet database engine cannot open the file
'C:\A2K\Backups\EdsBe2K.mdb'. It is already opened exclusively by another
user, or you need permission to view its data."

I have tried using a connection string, too, to no avail.

However, when I am in Windows Forms I have no problem opening the same
file using a connection control or connection string. There's no security
on the EdsBe2K.mdb file.

Thanks
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top