Monday, October 16, 2006

ASP Database Connection Strings: Access and SQL Server

SQL Server 2000 ODBC connection using Named Pipes:
Driver={SQL Server};
Server=ServerName;
Database=DatabaseName;
Uid=UserName;
Pwd=Password;
SQL Server 2000 and 2005 ODBC connection via IP address (IP Address,Port - default port is 1433):
Data Source=190.190.200.100,1433;
Network Library=DBMSSOCN;
Initial Catalog=DatabaseName;
User ID=Username;
Password=Password;
SQL Server OLE DB:
Provider=sqloledb;
Data Source=ServerName;
Initial Catalog=DatabaseName;
User Id=UserName;
Password=Password;
SQL Server 2000 OLE DB via IP address (IP Address,Port - default port is 1433):
Provider=sqloledb;
Data Source=190.190.200.100,1433;
Network Library=DBMSSOCN;
Initial Catalog=DatabaseName;
User ID=UserName;
Password=Password;
SQL Server 2005 ODBC connection using Named Pipes (You might need to download the SQL Server 2005 Native Client; the download contains both the ODBC and OLE DB providers):
Driver={SQL Native Client};
Server=ServerName;
Database=DatabaseName;
UID=UserName;
PWD=Password;
SQL Server 2005 Express ODBC connection to a database file (mdf):
Driver={SQL Native Client};
Server=.\SQLExpress;
AttachDbFilename=c:\path\database.mdf;
Database=DatabaseName;
Trusted_Connection=Yes;
SQL Server 2005 Express ODBC connection when the file resides in the data directory:
Driver={SQL Native Client};
Server=.\SQLExpress;
AttachDbFilename=DataDirectoryDatabase.mdf;
Database=dbname;
Trusted_Connection=Yes;
Access ODBC:
Driver={Microsoft Access Driver (*.mdb)};
Dbq=C:\Database.mdb;
Uid=Admin;
Pwd=;
Access OLE DB:
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=\path\Database.mdb;
User Id=admin;
Password=;

No comments: