Unspecified Error. Ensure that MDAC 2.6 or higher is installed in the machine ...

Problem

You receive the following message when attempting to run your application:

Unable to connect to database. Unspecified Error. Ensure that MDAC 2.6 or higher is installed in the machine...

According to Microsoft, the most frequent cause of this error is:

“The ASP.NET Web application that has the impersonation element set to true in the Web.config file, and that has the authentication element set to Windows in the Web.config file, runs under the impersonated account. The code in the ASP.NET Web application connects to an Access database.  When the connection is made, the Microsoft Jet OLE DB creates temporary files in the Temp folder in the following directory:

Document and Settings\ServerName\ASPNET\Local settings

where ServerName is the name of your server.

If the impersonated user account does not have read/write permissions enabled in the Temp folder, you receive the error message.”

Microsoft’s recommended solution

To resolve this problem, enable read/write permissions for the impersonated user account in the Temp folder. To do this, follow these steps:

Step 1:  In Windows Explorer, locate this folder:

\Document settings\<ServerName>\ASPNET\Local settings\Temp

where <ServerName> is the name of your server.

Step 2:  Right-click the Temp folder, and then click Properties.

Step 3:  In the Properties dialog, click the Security tab.

Step 4:  On the Security tab, click Add, and then type ServerName\UserAccount in the Select Users or Groups text box, where ServerName is the name of your server, and where UserAccount is the name of the impersonated account. Click OK.

Step 5:  Click to select the Read and the Write check boxes, and then click OK.

Other solutions

(1) Ensure that ASP.NET users have full permissions to access your database.  See ASP.NET User Does Not Have Permissions to Your Application Folder for instructions.

(2) Make sure the database file is not “write” protected.

(3) Make sure your database is not open in Microsoft Access.  When a Microsoft Access database file (MDB) is opened with OPEN or OPEN EXCLUSIVE mode in Microsoft Access, the run-time application cannot update the record since the MDB file is in use.  This generally occurs with Microsoft Access or another application has your database open at the same time as your web application.  Close Microsoft Access and try adding or updating the record again.

(4) Make sure all permissions have been applied to all the folders and subfolders used by your application and by your database.  Click the “Advanced” button in Windows Explorer to see folder permissions.

(5) Try granting permissions (including “execute” and “modify”) to these user accounts:

IUSR
IWAM
ASPNET

IUSR is used by non-.NET web applications to set file permissions.  .ASP, .HTML, .HTM, etc., all use IUSR to fetch pages and read registry keys.

IWAM is used for COM objects.  If you made a Visual Basic 6.0 class DLL that needed to access your file system, and your asp page only talked to the COM object, then you don't need to grant permissions to IUSR, but IWAM is a must.

For .NET applications (100% managed code - your code or third-party controls so long as they are not just wrapping older COM objects) use the new [to .NET] ASPNET user account.  ASPX pages, the Visual Basic .NET / C#  code-behind files, and class DLLs that you make all use ASPNET.

When Microsoft IIS sees the request coming in for a certain page, it parses the file extension.  If it is .ASP, .ASA, etc., the request is directly sent (by Microsoft IIS') to asp.dll to handle all of the details -- processing, parsing, rendering, etc.  If the requested filename is .ASPX, ASAX, ASMX, etc., then Microsoft IIS simply sends the request to aspnetwp.dll which checks additional security rights, etc.

Note: This error also occurs with Microsoft Office 2003 and can be fixed by updating Microsoft Office.

IUSR permissions on Microsoft Vista

On Microsoft Vista, grant read and write permission to IUSR for this folder:

C:\Windows\ServiceProfiles\NetworkService\AppData\Local

Related

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

http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&displaylang=en

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages