DB access denied

H

Haim

Hello everybody,

I'm kind of new in this so please be patient, and please
try to explain as simple as possible.
The code I'm using is in C#.
My problem is while trying to fill a dataset (an access
2003 DB using OLE DB Jet 4 Engine) I get the exception
that the DB is already in use. In my connection string
the connection mode is "Share deny None" so as for my
best understanding this should not happen.
The first thing I do in my application is to open the
connection. The connection, adapter and dataset where
created by the VS.NET wizard and the check is OK, I got
all the tables properties and it seems to work very well
in the designer mode.
The exception is raised by the line:
oleDbDataAdapterMain.Fill(this.dataSetKitlugimTable);

and my connection string is:
this.oleDbConnection1.ConnectionString = @"Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database Locking Mode=1;Jet
OLEDB:Database Password=;Data Source=""C:\my
docs\kitlugim.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet
OLEDB:Global Bulk
Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet
OLEDB:System database=;Jet OLEDB:SFP=False;Extended
Properties=;Mode=Share Deny None;Jet OLEDB:New Database
Password=;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User
ID=Admin;Jet OLEDB:Encrypt Database=False";

I tried also to change the
OLEDB:Database Locking Mode=1
to
OLEDB:Database Locking Mode=0 but this also didn't help.

Help will be very very very much appreciated! :)

Thanks,

Haim.
 
P

Paul Clement

¤ Hello everybody,
¤
¤ I'm kind of new in this so please be patient, and please
¤ try to explain as simple as possible.
¤ The code I'm using is in C#.
¤ My problem is while trying to fill a dataset (an access
¤ 2003 DB using OLE DB Jet 4 Engine) I get the exception
¤ that the DB is already in use. In my connection string
¤ the connection mode is "Share deny None" so as for my
¤ best understanding this should not happen.
¤ The first thing I do in my application is to open the
¤ connection. The connection, adapter and dataset where
¤ created by the VS.NET wizard and the check is OK, I got
¤ all the tables properties and it seems to work very well
¤ in the designer mode.
¤ The exception is raised by the line:
¤ oleDbDataAdapterMain.Fill(this.dataSetKitlugimTable);
¤
¤ and my connection string is:
¤ this.oleDbConnection1.ConnectionString = @"Jet
¤ OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
¤ Path=;Jet OLEDB:Database Locking Mode=1;Jet
¤ OLEDB:Database Password=;Data Source=""C:\my
¤ docs\kitlugim.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet
¤ OLEDB:Global Bulk
¤ Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet
¤ OLEDB:System database=;Jet OLEDB:SFP=False;Extended
¤ Properties=;Mode=Share Deny None;Jet OLEDB:New Database
¤ Password=;Jet OLEDB:Create System Database=False;Jet
¤ OLEDB:Don't Copy Locale on Compact=False;Jet
¤ OLEDB:Compact Without Replica Repair=False;User
¤ ID=Admin;Jet OLEDB:Encrypt Database=False";
¤
¤ I tried also to change the
¤ OLEDB:Database Locking Mode=1
¤ to
¤ OLEDB:Database Locking Mode=0 but this also didn't help.
¤
¤ Help will be very very very much appreciated! :)
¤

This error typically indicates there is a permissions problem on the folder where the Access
database is located. If you're working with an ASP.NET application then you need to provide full
access to the ASPNET account (if you're not implementing impersonation).

If this is a VB.NET application, and the folder location is a network share, then full access must
be granted to any network user that will be opening this database.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

Thank you very much!!!
The file is on my computer and so is the iis - I assumed
the ASPNET account is automaticaly a member of this
computer administrators group when installed so I didn't
even thought of checking this issue.

Thanks again!

Haim.
 
G

gh0st54

hi just to add
the reason for Paul's explanation is that when you open access it creates a
temp file to work with.
the aspnet user needs to be able to create a file in this case.
 
P

Paul Clement

¤ hi just to add
¤ the reason for Paul's explanation is that when you open access it creates a
¤ temp file to work with.
¤ the aspnet user needs to be able to create a file in this case.
¤

Yes, the locking database file (.LDB), thanks.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

I'm having exactly this problem but honestly cannot figure out any permission
problems. I'm running Windows XP with NTFS but not logging intoa domain. My
Access database file is in a non-protected directory and it is a brand new DB
with a single table , a couple text columns and a few records. Completely
generic. Same goes for VB.NET, fresh install, brand new C#=based solution
and project. From the Server Explore I am able to create the connection to
the Access DB with the Jed Driver, username of Admin and no password
(everything esle default). I do test connection, no problem. I can even
expand the data connection to browse the table and right-click -> Retrive
Data from Table, seem good so far.

Then I slect the fields I want from the data connection and drag them on to
the design pallet it creates the expected oleDbConnection1 and
oleDataAdapter1. I right-click the oleDataAdapter1 and select Generate
Dataset. In the end I end up witha very simple method exposed as a web
service:
[WebMethod]
public People1 GetCustomers()
{
People1 people = new People1();
oleDbDataAdapter1.Fill(people);
return people;
}

Seems straighforward enough, but i get this blasted
"The Microsoft Jet database engine cannot open the file
'C:\BegASPNET11\myFirst.mdb'. It is already opened exclusively by another
user, or you need permission to view its data."

I've used filemon to monitor for access denied messaged during this request
and see none so I'm certain this isn't an os-level security problem. Do I
need to do something security-wise with the Access db to resolve this?

This is especiall hard as I'm a Java guy trying to learn this so absolutely
everything is foreign.

Thanks for any help!

~dave
 

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

Top