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;" & _
Set conn = Server.CreateObject("ADODB.Connection")

Here is an example for use with ColdFusion:

<CFQUERY NAME="qrySample"
 CONNECTSTRING="DRIVER={Microsoft Access Driver (*.mdb)};
SELECT * FROM tblSample

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.