Connection Strings

From Hostek.com Wiki
Revision as of 16:19, 21 November 2012 by Briana (Talk | contribs)

Jump to: navigation, search


Access Database Connection String Examples

Using DSN-less method

Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\home\mysite.com\db\myfile.mdb;"

Using DSN

Conn.Open "MyDSN"

Set Conn = CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\home\mysite.com\db\myfile.mdb;"


MySQL Connection String (ASP)

Dim conDB
Dim rs
'--Set the connection
Set conDB = CreateObject("ADODB.Connection")
'--You may need to use OPTION=3 instead of 16834
conDB.Open "DRIVER=MySQL ODBC 3.51 Driver;SERVER=mysql10.hostek.com;OPTION=16834;USER=db_un;Password=db_pw;DATABASE=db_name"
'--Set the recordset
Set rs = CreateObject("ADODB.Recordset")


MSSQL Connection String (ASP)

ConnStr="DRIVER={SQL
Server};SERVER=sql1.hostek.com;UID=db_username;PWD=db_password;DATABASE=db_name"
Conn.open ConnStr

Replace the username, password, and database name with the information for your database.