ASP cannot open encrypted Access 2007 database file via ODBC

 

Symptom:

To reproduce the issue:

1. Install “2007 Office System Driver: Data Connectivity Components” in order to open the new Access 2007 .accdb database file.

https://www.microsoft.com/downloads/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en

2. Place an .accdb Access 2007 database file on server.

The database is password encrypted.

3. Setup an ODBC system DSN and point it to the .accdb database file.

Enter the database password in advanced options dialog box.

4. Open the database in ASP page

<%

dim cn

set cn=server.createobject("adodb.connection")

cn.open "dsn=dsn1"

%>

This error message occurs:

Error 0x80004005 “Not a valid password”

Troubleshooting:

However similar .vbs code works.

dim cn

set cn=createobject("adodb.connection")

cn.open "dsn=dsn1"

And ASP works if the database is not encrypted.

Resolution:

In order to let it work, you must apply “Microsoft Office Access Runtime and Data Connectivity 2007 Service Pack 2 (SP2)” first.

https://www.microsoft.com/downloads/details.aspx?FamilyId=6F4EDEED-D83F-4C31-AE67-458AE365D420&displaylang=en

And then grant read/write permission to .accdb database file and .laccdb lock file to the IIS anonymous user account.

NOTE: Access is not recommended for server environment, for better performance and scalability, please using SQL server instead.

Best Regards,

Juntao Zhu