Difference between revisions of "Connection Strings"
From Hostek.com Wiki
m (Briana moved page Connection Strings (MS Access) to Connection Strings without leaving a redirect) |
|||
| Line 1: | Line 1: | ||
| − | ==Connection String Examples== | + | __FORCETOC__ |
| + | |||
| + | |||
| + | ==Access Database Connection String Examples== | ||
===Using DSN-less method=== | ===Using DSN-less method=== | ||
| Line 11: | Line 14: | ||
Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\home\mysite.com\db\myfile.mdb;" | Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\home\mysite.com\db\myfile.mdb;" | ||
</pre> | </pre> | ||
| + | |||
| + | |||
| + | ==MySQL Connection String (ASP)== | ||
| + | <pre> | ||
| + | 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") | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | ==MSSQL Connection String (ASP)== | ||
| + | <pre> | ||
| + | ConnStr="DRIVER={SQL | ||
| + | Server};SERVER=sql1.hostek.com;UID=db_username;PWD=db_password;DATABASE=db_name" | ||
| + | Conn.open ConnStr | ||
| + | </pre> | ||
| + | |||
| + | Replace the username, password, and database name with the information for your database. | ||
[[Category:Databases-Access]] | [[Category:Databases-Access]] | ||
| + | [[Category:Databases-MySQL]] | ||
| + | [[Category:Databases-MSSQL]] | ||
Revision as of 16:19, 21 November 2012
Contents
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.