Relative and Absolute Path Names for Microsoft Access Databases

When deploying an application to production that uses a Microsoft Access database, if you do not know the full file system path to the database file (.mdb), you can specify a relative path in the database connection string found in the application's Web.config file.  This will only work if the database file is located somewhere in the application folder.

For example, suppose you create an application called MyApp1 in the C:\MyApps folder on your development machine.  Further, suppose you copy your Microsoft Access database file to a subdirectory of the application so that the full path to the database file is:

C:\MyApps\MyApp1\Database\MyDatabase.mdb

Iron Speed Designer will create a database connection string in your application's Web.config file with the full path to the .mdb file:

<add key="DatabaseMyDatabase.mdb1" value="Provider=Microsoft.Jet.OLEDB.4.0;

     Data Source=C:\MyApps\MyApp1\Database\MyDatabase.mdb;

     Jet OLEDB:Database Locking Mode=1;

     Mode=16" />

When deploying the application and database to production, you can change the connection string in your application’s Web.config file to use a relative path:

<add key="DatabaseMyDatabase.mdb1" value="Provider=Microsoft.Jet.OLEDB.4.0;

     Data Source=Database\MyDatabase.mdb;

     Jet OLEDB:Database Locking Mode=1;

     Mode=16" />

See Also

Microsoft Access Support

Microsoft Access 2000 Versions

Microsoft Access Database Field Support

Query Support in Microsoft Access

Linked Databases in Microsoft Access

Relative and Absolute Path Names for Microsoft Access Databases

Accessing Microsoft SQL Server Tables through Microsoft Access Queries