The Microsoft Jet database engine cannot open

Problem

You see this error message either onscreen or in the Event Viewer when running your application:

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

This error occurs when you are using Microsoft Access as your application’s database.  There are a variety of causes for this error.

ASPNET user configuration

This Microsoft Knowledge Base article discusses one possible cause:  The ASP.NET worker process runs under the default ASPNET account. If you do not enable impersonation for an application, all of the threads that run the requests for that application run under the process account.

http://support.microsoft.com/default.aspx?scid=kb;en-us;316675

This article suggests several solutions:

The MDB file cannot be read-only

This is perhaps the most common cause of problems with Microsoft Access databases.

Microsoft Access databases can only be located on the local drive

This is a restriction of the Microsoft JET driver and not of Iron Speed Designer.

Folders containing MDB files must have Read and Write permissions

The MDB file may be located in any folder on the local drive, but the folder must have Read/Write permission for the ASPNET user.  Go to Windows Explorer and add the ASPNET user to have Full permissions on the folder containing the MDB file.

The path specified in your application’s Web.config file must be a fully specified path

Relative paths in the Web.config file are supported starting with Version 2.1.2 of Iron Speed Designer.

The ASPNET account must have read and write permissions to the Temp folder

Make sure the ASPNET user account has full read and write permissions to your system’s Temp folders, such as:

C:\Documents and Settings\ASPNET\Local Settings\Temp

C:\Windows\Temp

Step 1:  Review your system’s Environment Variables under the target System properties to see where the Temp folders are located.  Please note that the Local Settings folder may be hidden and you may need to enable it for viewing.

Step 2:  Make sure the ASPNET user has full read and write permissions to those folders.

See Also

Application Runs But No Data is Displayed

Part IX:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages