Database connection strings

Choosing the exact database connection string type for a project depends on the environment and the features/performance needed. The connection strings below are just examples what should work in most scenarios with both ASP/VBScript and dot Net. For a full list of connection strings, visit www.connectionstrings.com.

To connect to an MS Access/Jet database file, you can use this connection string:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\database.mdb;"

To connect to an MS SQL Server, you can use this connection string (line wrapped):

"Provider=SQLOLEDB;Data Source=servername;Initial Catalog=databasename;User ID=user;Password=password;Network Library=DBMSSOCN;"

To connect to a MySQL server from MS Windows you need something like this (line wrapped):

"DRIVER={MySQL ODBC 3.51 Driver}; Server=servername; Database=databasename; UID=user; PWD=password; Option=3"

(To connect to a MySQL server, you have to install the MySQL ODBC driver)