ASP Classic “cannot open the file” Microsoft JET Database Engine error '80004005'

We have a Microsoft Windows 2003 server with an ASP Classic application on it.  The ASP Classic application links to a Microsoft Access database (2002-2003 file format) on the same server. Everything works fine.  Also, I can open the Microsoft Access database with Access 2010 without problem.
We have stood up a new Microsoft Windows 2012 server without IIS for the database and moved the Microsoft Access database to the Microsoft Windows 2012 server.
When we change the ASP Classic application connection string to point to the new server,
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb; Persist Security Info=false"
I receive the following error:
Microsoft JET Database Engine error '80004005'
The Microsoft Jet database engine cannot open the file '\\ApplicationName\db$\ApplicationName\data\ AccessDatabase_d.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
 /ApplicationName/default.asp, line 1333
The database is not open exclusively and permissions levels are set to “modify” down to the database itself.  I cannot touch the server myself, but I think the connection problem may have something to do with the “Microsoft.Jet.OLEDB.4.0”.  Our network and application guys are at a loss.  

Several Expert Exchange references talk about changing to a generic driver, But I am not sure of the syntax for the code below.

Full Code:
  '--- Open Connection to database using the System DSN name ---
  Set oCon = Server.CreateObject("ADODB.Connection")
  set RS = Server.CreateObject("ADODB.Recordset")
  strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb; Persist Security Info=false"
  oCon.Open strConn
DMontgomeryNGCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert ShermanOwnerCommented:
You said that the permissions are set to "modify" down to the database itself.  If you only have modify permission on the file, that's not going to work.  You need to have create permissions for the folder that the database file resides in.

EDIT: just to further explain..  Access files are locked via a secondary file that gets created and destroyed as users open and close the database.  Sounds to me like the problem you are running into is not being able to create and/or delete the lock file.
DMontgomeryNGCAuthor Commented:
Robert,
When I talk about permissions, I am speaking of the network groups on a server.  The options are: Full Control, Modify, Read & execute, List folder contents, Read, Write, and Special permissions.
With Modify, you also are automatically granted Read & Execute, List folder contents, Read, and Write permissions.
There is no Create.  
Is there another set of permissions I should be looking at?
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
You said you were able to open access directly.  I don't think you can have access "open" while using it as a data source for your web server http://tutorials.aspfaq.com/8000xxxxx-errors/80004005-errors.html.  

Also, I suggest moving to  ole db dsn-less connection instead of a dsn.  The specifics are at https://www.connectionstrings.com/microsoft-jet-ole-db-4-0/.  I personally have not used ms access for this in a long time.    I do know you have to have the folder set to read/write/execute.  But the part about having access open on the server sounds right.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

DMontgomeryNGCAuthor Commented:
Scott,
I stated that I could open the Microsoft Access database with Access 2010 without problem, not that it was open while trying to use the ASP Classic application.  I will look at the dsn-less tutorial within the hour and recommend a change if I understand it.
DMontgomeryNGCAuthor Commented:
Scott,
I looked at the at https://www.connectionstrings.com/microsoft-jet-ole-db-4-0/ tutorial and I did not see anything for dsn-less.  Only the following was listed under Access 2002 and Access 2003:
     Standard Security
     With database password
     Workgroup
     DataDirectory functionally
     Network Location
     Using RMS
     Exclusive
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I'm just saying that is a potential issue.  Access creates a temporary file that locks out other programs.  One possibility is access was not fully closed.  Another possibility is the lock file still exists.  I seem to remember having to delete those files at the command line for some reason.  

Also, how is the server that access is on linked to the web server?  Do you have a drive mapped?    https://www.connectionstrings.com/microsoft-jet-ole-db-4-0/
DMontgomeryNGCAuthor Commented:
The link is:
         Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;
where \\NewServer name is the actual name of the server.  It is not mapped as in K:\...
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
https://www.connectionstrings.com/access-2003/
From that page it shows these are for 32 bit mode.  It does not look like you can use access 2003 in 64 bit?  I have not used access as a web database in 15 years, perhaps there is somebody else that can answer. I have converted to sql server.
Standard security
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;
Password=;

Open in new window

With database password
This is the connection string to use when you have an access database protected with a password using the Set Database Password function in Access.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;
Jet OLEDB:Database Password=MyDbPassword;
Some reports of problems with password longer than 14 characters. Also that some characters might cause trouble. If you are having problems, try change password to a short one with normal characters.

Open in new window

DMontgomeryNGCAuthor Commented:
Scott,
I appreciate your taking the time to look into it.
Hopefully, someone else has run into this problem and can help.
Robert ShermanOwnerCommented:
I have run into this exact problem a number of times in the past, though it has also been a few years for me as well.  I still believe in most cases the problem ended up being the file permissions on the server.  You said you don't have direct access to the server, is there somebody who does that can have a look in the folder the database is in.  One thing that I can definitely remember is having the lock file get stuck, where it needed to be manually deleted by someone logged into the server with admin rights.   You can check for this by bringing down the instance of IIS that runs your database app, and make sure nobody has the file open in Access.  Once your sure nothing is accessing the database, check in the same folder for the file with the same name as your database file but with an .ldb extension.  That file should not be there if the database is not open.  Try to delete it, that might fix the problem.

I'm pretty sure you can use the 32-bit drivers under 64-bit OS, and trying DSN-less connection might be worth a go.  Another potential solution is to give the drive a letter-mapping on the IIS box, and then change the connection string to use the drive letter instead of the full \\Server\resource style reference.
DMontgomeryNGCAuthor Commented:
I was alert to the ldb file and it was not present prior to the error occurring.
I do not know how to make a DSN-less connection in ASP Classic.  From my code above, can you give me an example?
I have not tried creating a drive letter-mapping on the IIS box and changing the connection string.  I can get on our Network support calendar later this week (they are heavily booked) and try that,
I was hoping a code change (DSN-less connection)  or maybe something about the new 2012 OS needing  "OLEDB.4.0" would be the solution.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Couple comments:

<< I still believe in most cases the problem ended up being the file permissions on the server. >>

As said, usually it is.  From the web server, see if you can:

1. Create a text file in the directory where the DB resides.
2. Edit that file and save it.
3. and delete it.

  If you can do that simple test, then you have all the permissions you need.  The only thing you would need to check further is the DB file itself.

IMPORTANT NOTE: Keep in mind that the web server software is using an account different than yours....make sure you have set permissions for the account the web software is using and when testing, login with that account if possible.

<<I'm pretty sure you can use the 32-bit drivers under 64-bit OS, and trying DSN-less connection might be worth a go. >>

  You can.  It's the software making the calls that determines what drivers you need.  If the web software is 32 bit, you'd need a 32 bit DSN.   If it's 64 bit, then you'd need 64 bit DSN and drivers.

  Note that 64 bit DSN's are created with:

C:\Windows\System32\odbcad32.exe

 32 bit DSN's are created with:

C:\Windows\sysWOW64\odbcad32.exe

  Confusing huh?   If you go DSN less, you would avoid this issue.

 But if nothing has changed other than the location of the file, then this is not the problem.  If the web server itself was changed to 64 bit, then you'd need the 64 bit DSN (if you still use it) and driver.

<<  It does not look like you can use access 2003 in 64 bit? >>

 64 bit drivers for JET/ACE can be gotten here:

http://www.microsoft.com/en-us/download/details.aspx?id=13255

and you'd use:

Microsoft.ACE.OLEDB.12

 as the provider.

Jim.
Big MontyWeb Ninja at largeCommented:
you can try using standard ODBC:

Driver={Microsoft Access Driver (*.mdb)};Dbq=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;

but if you have a temp file that's locked there, this will give you the same message you've been getting
DMontgomeryNGCAuthor Commented:
I can:
 1. Create a text file in the directory where the DB resides.
 2. Edit that file and save it.
 3. and delete it.
on the new server with no problem.  That set of permissions is OK.

I am talking with the network group to make sure they have set permissions for the account the web software is using and when testing, I or they, will try to login with that account.
DMontgomeryNGCAuthor Commented:
Big Monty,
With the following code,
 '--- Open Connection to database using the System DSN name ---
   Set oCon = Server.CreateObject("ADODB.Connection")
   set RS = Server.CreateObject("ADODB.Recordset")
   strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb; Persist Security Info=false"
   oCon.Open strConn

where would
 Driver={Microsoft Access Driver (*.mdb)};Dbq=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;
be inserted?
Big MontyWeb Ninja at largeCommented:
you would change

strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb; Persist Security Info=false"

to

strConn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;"
DMontgomeryNGCAuthor Commented:
Big Monty,
They made the change in the code and I receive the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xe2c Thread 0xf08 DBC 0x1969524 Jet'.

/ApplicationName/default.asp, line 1337

---------------------------------------------------------------------------
Line 1336 in default.asp is:
strConn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;"

Line 1337 in default.asp is:
  oCon.Open strConn

I appreciate you providing an implementation of the connection string.
Big MontyWeb Ninja at largeCommented:
looks like the issue is a permissions issue then:

https://support.microsoft.com/en-us/kb/295297

does the account running the website (by default, it's IUSR_MachineName and the account NETWORK SERVICES) have full permissions to the folder?
DMontgomeryNGCAuthor Commented:
I have passed that question on to our network group and am waiting for an answer.
I will let you know when they reply.
DMontgomeryNGCAuthor Commented:
This is the reply from our network admin group:
Everyone means everyone, any and every account (local or domain).  Nevertheless, I’ve added the accounts below.  The IUSR_MachineName isn’t available.  I’ve submitted the reason below.  IIS isn’t installed on this server.
Understanding the New IUSR Account
The IUSR account replaces the IUSR_MachineName account in IIS 7 and above. The IUSR_MachineName account will still be created and used if you install the FTP 6 compatible server that is included in Windows Server 2008. If you do not install the FTP server that is included with Windows Server 2008, then this account will not be created.

The “Everyone” group has modify access from DB$ down through the entire path.

So with the permissions set to modify and using the:
strConn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb;"
connection string yields the following error

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xcec Thread 0xbfc DBC 0x18a4024 Jet'.
ProjectName/default.asp, line 1337


With the permissions set to modify and using the
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb; Persist Security Info=false"
connection string yields the following error

Microsoft JET Database Engine error '80004005'
The Microsoft Jet database engine cannot open the file '\\NewServer\db$\ApplicationName\data\AccessDatabase_d.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
ProjectName/default.asp, line 1337

Do you (or anyone else) have any additional thoughts?  It shouldn't be this hard pointing to a different server with the same database.  (But I guess that's why we have Expert Exchange :) )
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
It's permissions and your network guys are missing something.

  All that has been changed is the location of the DB correct?  Nothing on the web server?

  Keep in mind that with a JET database, the "server" acts as nothing more than a file share.  All the processing is handled on the web server.

  To verify, move the database back to where it was, and verify operation.  

Jim.
DMontgomeryNGCAuthor Commented:
Jim,
1.  All that has been changed is the location of the DB correct?  Nothing on the web server?
    Correct for both questions.

2.  To verify, move the database back to where it was, and verify operation.
      They changed the connection string to point back to the original Microsoft Access database which is on the same server as the ASP Classic code, but different hidden share, and it works fine.

3.  It's permissions and your network guys are missing something.
     I do not doubt what you are saying - we just can't figure it out.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Hum...

They did check the share and directory permissions right?

also, is it possible for you to place the DB on another machine on a share and check?

I'm wondering if it's actually something on the web server blocking because the file is remote rather than the server where the DB is sitting.

Jim.
DMontgomeryNGCAuthor Commented:
Jim,
1.  They did check the share and directory permissions right?
      YES, both share and directory permissions have been opened up.

2.  Is it possible for you to place the DB on another machine on a share and check?
      I was able to load the database on an OS 2008 server using the same directory path and received the same error messages as on the OS 2012 server.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
OK, so looks like something on the web server because the file is remote, so:

1. Check if the web user has the privs to write to the %TEMP% directory.

2. Map a drive letter and try that instead of the UNC naming.

Jim.
DMontgomeryNGCAuthor Commented:
Jim,
1.  The permissions have been set on %TEMP%.   I receive the same errors.
 
2.  I am being told that the Drive mappings are user specific, not universal.  If the Network Admin maps a drive, it only appears when they are logged on.

3.  Also, I have compacted and repaired the Microsoft Access database just in case (no problems)
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Would you need a reverse proxy?   What about just putting the access database on the webserver?   If the database is being used on the non web server directly and the web server is only for reporting, perhaps just run a scheduled task to over write the mdb file.  Or perhaps add sql server express on the non web server and connect that to the access database and access the data through sql server.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
1. Check the IIS log to see if it offers any more detail.

2. Follow the instruction here in regards to %TEMP%:

 Error message when you request an ASP page that connects to an Access database in IIS 7.0: "Microsoft JET Database Engine error '80004005'"
https://support.microsoft.com/en-us/kb/926939

 Note that if you run the app pool under a identity other than the network service, change the command.

 if it still doesn't work, then you may want to try the workaround of turning the load user profile to off.  You can do that by editing the config file as the MSKB shows, or use the command:

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false

 This must be done in an elevated window (right click, run as admin).

 Let me know if that does it for you.

 Jim.
DMontgomeryNGCAuthor Commented:
I will try to get them to do this today and let you know the results.
DMontgomeryNGCAuthor Commented:
Scott,
Can you explain the "reverse proxy"?
DMontgomeryNGCAuthor Commented:
Jim,
The Network Admin states "the path highlighted below is an empty folder, so the bin file isn’t present either." if that makes sense to you.   The part of the path he highlighted from your comment was:

%windir%\system32\inetsrv\


Your comment:
 if it still doesn't work, then you may want to try the workaround of turning the load user profile to off.  You can do that by editing the config file as the MSKB shows, or use the command:

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false


A general question:
Do I need IIS installed on the file server that contains the Microsoft Access database?  The ASP Classic application is on another server with IIS.
Big MontyWeb Ninja at largeCommented:
A general question:
Do I need IIS installed on the file server that contains the Microsoft Access database?  The ASP Classic application is on another server with IIS.

no, but the user that runs the site (IUSR) and the application pool need to have access to the folder the database resides in.

can you provide a screen shot of users that have access to that folder?
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Do I need IIS installed on the file server that contains the Microsoft Access database?  The ASP Classic application is on another server with IIS. >>

 No.  The problem is simply that when IIS goes to make the connection which is now remote, the account used doesn't have permission some where along the line.  That is proven out by the fact that when local, everything works.

 Also the fact that you can move the BE to another server (not the new 2012 server), points out that the issue is on the web server.

 This was a common problem with many IIS6 installs that move to IIS7.  Microsoft made a change in the application pools and security.

 Did the IIS log show anything?

Jim.
DMontgomeryNGCAuthor Commented:
Jim and Big Monty,
It will be Monday before the Network Admin can get to it.  I am sorry for the delay.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big MontyWeb Ninja at largeCommented:
I'm not putting in an objection but it just wanted to throw in my last 2 cents worth. Instead of a doing an entire rewrite you may want to consider paying someone to come in and try to fix it. This seems like such a minor thing to fix that it reminds me of buying a new car when you get a flat tire :l

Just something to think about
DMontgomeryNGCAuthor Commented:
The ASP Classic platform is declining is no longer a standard with our company.  ASP.NET has been the standard for the last 7 years  and the cost for maintaining ligancy platforms can become expensive.  This is why they have decided to rewrite the application.
Thank  you for your assistance.
DMontgomeryNGCAuthor Commented:
Management's decision is to not expend any more hours on this and re-write the ASP Classic application in ASP.NET.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.