Click to See Complete Forum and Search --> : ASP.NET database connection problem


bioS
09-29-2003, 08:36 AM
Hi,

I'm new in ASP.NET and I'm trying to make my first page in C# with a connection to an Access database.

I've created an OleDbConnection and an OleDbDataAdapter which must fill a DataSet.

But the connection can't open and I get this error message:

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

I've tried to change the file and directory's permissions, but no way, I can't resolve it.

If I use the same code for a windows application, it works fine.

Could anyone explain me what is the problem and how to resolve it ?

ukemike
09-29-2003, 10:43 AM
Hey i have had the same problem. my teacher is going to find the solution for this problem next week.

Ribeyed
09-29-2003, 01:27 PM
Hi,
you need to not only make sure that the database has read/write permissions but that IUSR_YOURSERVERNAME also has read/write access to the database.

bioS
09-29-2003, 01:43 PM
Hi Ribeyed,

It is actually not enough. I already did it, and it didn't change the problem.

I have partially resolved it, by giving full access to 'everyone' to the directory and the .mdb file. But I'm not sure that it will work on-line, by my web hosting company...

Actually, I'm wondering if the user acount used to call my Access file is ASPNET, and not IUSR_xxx.

PeOfEo
09-29-2003, 05:37 PM
This is probably a no brainer but make sure you dont have the data base open in access when you are trying to run your applications. Also access data bases can only have 10 people logged into them at a time. It would be something to ask the server admin about because it does not seem to be a scripting issue at all. Check your web.config and if it is doing any of that default user crap and see what the login name and pass is in there too.

bioS
09-30-2003, 03:18 AM
The database isn't open, I'm sure as it still runs on my own machine.

And there isn't any login name and password in the web.config. Authencation mode is set to 'Windows'.

PeOfEo
09-30-2003, 08:34 PM
Well wait, so you are saying the page works on your machine with the data base but when you upload them both to the server it fails? You are not trying to do some remote hosting or anything like that correct? This is very odd then. If this is only running off of your machine consider making an acount at http://europe.webmatrixhosting.net (just because they are high quality hosting, yet they are microsoft sponsored so they are free) and testing it there.