Database Connection String Samples
This page contains sample connection strings for:
- ODBC - DSN
Const HDW_MSSQL_CONNSTR = "DSN=mySystemDSN;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
- ODBC DSN-Less Driver for Access
For Standard Security:
Const HDW_MSSQL_CONNSTR = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Uid=admin;" & _
"Pwd="
If you don't know the path to the MDB (using ASP)
Const HDW_MSSQL_CONNSTR = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & Server.MapPath(".") & "\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="
This assumes the MDB is in the same directory where the ASP page is running. Also make sure this directory has Write permissions for the user account.
- ODBC Driver for SQL Server
Const HDW_MSSQL_CONNSTR = "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
- OLE DB Provider for Microsoft Jet (MSAccess)
Const HDW_MSSQL_CONNSTR = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
- OLE DB Provider for SQL Server
Const HDW_MSSQL_CONNSTR = "Provider=sqloledb;" & _
"Data Source=myServerName;" & _
"Initial Catalog=myDatabaseName;" & _
"User Id=myUsername;" & _
"Password=myPassword"