How To Use Microsoft Access Database On CD/DVD

Normally, when you open a Microsoft Access database, a file (LDB) containing record locking information needed to handle concurrent access to the database is created. Obviously this does not work for Access databases hosted from a CD or DVD because they are read-only devices. To resolve this, you must add the following two parameters to your connection string: ReadOnly=1 and Exclusive=1.

Here is an example for use with ASP Classic 3.0 (VBScript):

<%
Dim DSN, conn
DSN = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
      "DBQ=" & Server.MapPath("Northwind.mdb") & ";" & _
      "UID=admin;" & _
      "PWD=;" & _
      "ReadOnly=1;" & _
      "Exclusive=1;"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open(DSN)
%>

Here is an example for use with ColdFusion:

<CFQUERY NAME="qrySample"
 DBTYPE="dynamic"
 CONNECTSTRING="DRIVER={Microsoft Access Driver (*.mdb)};
                DBQ=#ExpandPath('\')#Northwind.mdb;
                UID=Admin;PWD=;ReadOnly=1;Exclusive=1;">
SELECT * FROM tblSample
</CFQUERY>

Using this method, you can use Microsoft Access databases directly from your CD/DVD without the need of copying it to the user’s hard drive.