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.

This Post Has 2 Comments

  1. Stacy

    Thank you for sharing the connection string.

  2. jolongestr

    wow my hosting client hosting issue is resolve thankyou

Leave a Reply