Connection strings for Access

Providers for Access

»Microsoft Jet OLE DB 4.0
».NET Framework Data Provider for OLE DB (OleDbConnection)
»Microsoft Access ODBC Driver
».NET Framework Data Provider for ODBC (OdbcConnection)

Community Forums

Find solutions and post questions regarding connection string related issues.

Forum for Access >

Microsoft Jet OLE DB 4.0

Type:OLE DB Provider
Usage: Provider=Microsoft.Jet.OLEDB.4.0

Manufacturer:Microsoft

Customize string
example values »

Standard security

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

How to Use JET in 64 bit environments >

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;

Some reports of problems with password longer than 14 characters. Also that some characters might cause trouble. If you are having problems, try change password to a short one with normal characters.

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=;

Network Location

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\serverName\shareName\folder\myDatabase.mdb;User Id=admin;Password=;

Using RDS (MS Remote)

Access database over HTTP. You must setup RDS on the server for his to work.

Provider=MS Remote;Remote Provider=Microsoft.Jet.OLEDB.4.0;Remote Server= Source=d:\myPath\myDatabase.mdf;

Exclusive

Used to get exclusive access to the database if you, for instance, want to let the application be able to reset the database password.

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

.NET Framework Data Provider for OLE DB

Type:.NET Framework Wrapper Class Library
Usage: System.Data.OleDb.OleDbConnection

Manufacturer:Microsoft
More info about this wrapper class library »

Customize string
example values »

Bridging to Jet OLE DB 4.0

This is just one connection string sample for the wrapping OleDbConnection class that calls the underlying OLEDB provider. See respective OLE DB provider for more connection strings to use with this class.

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

Microsoft Access ODBC Driver

Type:ODBC Driver
Usage: Driver={Microsoft Access Driver (*.mdb)}

Manufacturer:Microsoft

Customize string
example values »

Standard Security

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;

Workgroup

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatabase.mdw;

Exclusive

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=admin;Pwd=;

Enable admin statements

To enable certain programatically admin functions such as CREATE USER, CREATE GROUP, ADD USER, GRANT, REVOKE and DEFAULTS (when making CREATE TABLE statements) use this connection string.

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;ExtendedAnsiSQL=1;

Specifying locale identifier

Use this one to specify the locale identifier which can help with non-US formated dates.

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Locale Identifier=2057;Uid=Admin;Pwd=;

The above example uses the en-gb locale identifier (2057)

.NET Framework Data Provider for ODBC

Type:.NET Framework Wrapper Class Library
Usage: System.Data.Odbc.OdbcConnection

Manufacturer:Microsoft
More info about this wrapper class library »

Customize string
example values »

Bridging to Microsoft Access ODBC Driver

This is just one connection string sample for the wrapping OdbcConnection class that calls the underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this class.

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;