Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error opening Access database w/ Jet

Status
Not open for further replies.

jasek78

Programmer
Nov 5, 2001
298
US
Here is my connection string:

Code:
DB_CONN_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath("quiz1.mdb") & ";"

Here is the Error:

Code:
    * Error Type:
      Microsoft JET Database Engine (0x80004005)
      The Microsoft Jet database engine cannot open the file 'C:\Inetpub\[URL unfurl="true"]wwwroot\wbttest\aspquiz2\quiz1.mdb'.[/URL] It is already opened exclusively by another user, or you need permission to view its data.


The file is not open, and I can't find any more permissions to set. I set up the directory in IIS (running on a Win2000 box) Can someone help?

jason
 
I had this problem and solved it by putting my asp page in the same directory as my mdb. Simple, but for whatever reason, it worked.
 
I did not set one... What would I need to do?
 
Try something like this:

objRecordset.Source = "YOUR_SOURCE"
objRecordset.ActiveConnection = DB_CONN_STRING
objRecordset.LockType = adLockPessimistic
objRecordset.CursorType = adOpenKeyset

objRecordset.Open
 
The script isn't even getting to that point. The error message points at the connection.open line. I was thinking that it was the connection string that was doing it.

I tried the following as a connection string, as well...but still the same results.

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("db\testbank.mdb") & ";User ID=;Password=;"


jason
 
First, I would try moving it to a different directory. Actually, just copy the database to a different directory and then just delete the one that's giving you the headaches. Watch for the evil .ldb file that might be in there. Delete it if you see it.

Secondly, if it is permissions, then the way to make sure you're on track is to browse over to the directory, and then right click on it, ask for security and you should see a list of users there. Make sure that the IUSR account for your machine has at least read access to the directory, and write, if necessary.

hope that helps! :)
paul
penny.gif
penny.gif
 
You may have to specify a username of "admin" with no password.
 
Tried moving it, and tried specifying a username. Still no dice. I'm about to just junk it and start a fresh script and database. Any other thoughts on the matter? I'd really prefer to fix it (so I know what was wrong with it)

Thanks to all for your help.

jason
 
Have you been able to make a connection to other databases from your machine using this type of connection string?

If not, I would check all the data link properties for your machine to be sure you are set up to use the jet database engine.

In Win 2000, I think this is under "administrative tools"
 
I use a .UDL file to create the connection string. I test it in the file, and the connection succeeds every time. I recently completed a VB program using ADO with the JET DB engine. I also just completed a different web app in ASP with the same engine.

Question: Would the Jet 4.0 DB engine work with a Access97 database? Or would I need to use the 3.51 version?
 
I suggest you make sure the file is not open by anything else. Use the Sysinternals filemon utility (as recommended my Microsoft) to see if any processes are accessing your db.


Have you tried stopping and starting IIS? Is your page closing its connections and recordsets? Make sure nothing to do with your DB is being put into a session variable.
 
OK, I took it down this time...

I created a new database, then imported the tables into it. Renamed it and viewed the page (which worked perfectly this time!)

Again, thanks for your help, cactus1000 (and link9).

jason
 
BTW... that is how I create my connection strings. I'm not sure why it did not like the old database. It was originally a Access97 db, and I converted it to 2000. Maybe the conversion was bad? But it works now. Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top