OleDB connection string examples – SQL server and Microsoft Access

OleDB connection string

An OLE DB connection enables to connect to a data source by using an OLE DB provider. For example, an OLE DB connection manager that connects to Microsoft Access database or SQL Server can use the Microsoft Access Jet or Microsoft OLE DB Provider for SQL Server.

Following is the sample connection string for Microsoft Access (Jet OleDB):

"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=[Database_Path];User ID=Admin;Password=dbpassword"

Instead of providing full path of your Microsoft Access database, you can use Server.Mappath function as well. You do not need to specify username and password if your Microsoft Access database is not password protected.

Following is the sample connection string for Microsoft SQL server (using OleDB connection):

"Provider=sqloledb;Data Source=[SQLServerName];Initial Catalog=[DatabaseName];User Id=[SQL_Database_user];Password=[Database_User_Password]"

For ASP.Net application, you should consider using the .Net native SQL data provider rather than using OleDB connection string.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top