Connecting to Access with OleDB

You can also connect to an access database with an OleDB database driver. The Microsoft Jet OleDB driver is a good option to use Access databases. In this section we give you the connection strings you can use if you wish to connect through OleDB.

Standard security

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;

With database password

This is the connection string to use when you have an access database protected with a password using the Set Database Password function in Access.

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;

Workgroup (system database)

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;

Workgroup (system database) specifying username and password

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword;

DataDirectory functionality

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\myDatabase.mdb;User Id=admin;Password=;

More information