Brinkster Knowledge Base

KB Home   /  Support  /  Database  /  MS SQL  /   How do I connect to a MS SQL database with ASP
How do I connect to a MS SQL database with ASP Articles
** Important information regarding the following code samples. **

All references to "UserName" need to be replaced with your actual Brinkster UserName.
All references to "Password" need to be replaced with your actual Brinkster Password.
All references to server hostnames are not specific. Please log into your account, select the web site settings, and use the hostname shown there.


MS SQL Server DSN-Less connection:


The server name reference 'sql.Brinkster.com' is not specific:
Your specific SQL hostname is listed in Website Settings of the account control panel.

<%

Dim dbhost, dbname_and_username, dbpwd, oConn, dbConn

 

dbhost = "premsqlX.brinkster.com"

dbname_and_username = "Brinkster_UserName"

dbpwd = "Brinkster_Password"

 

Set oConn = Server.CreateObject("ADODB.Connection")

dbConn = "DRIVER=SQL Server; SERVER="& dbhost &"; UID="& dbname_and_username &"; PWD="& dbpwd &"; Network Library=dbmssocn;"

oConn.Open(dbConn)

response.write "<br><br><center>The MS SQL connection has been opened.<br><br>"

 

oConn.Close

response.write "The MS SQL connection has been closed.</center>"

Set oConn = nothing

%>

 

SQL Server DSN-Less connection:

The server name reference 'sql.Brinkster.com' is not specific:
Your specific SQL hostname is listed in Website Settings of the account control panel.

<%

Dim dbhost, dbname_and_username, dbpwd, oConn, dbConn

 

dbhost = "premsqlX.brinkster.com"

dbname_and_username = "Brinkster_UserName"

dbpwd = "Brinkster_Password"

 

Set oConn = Server.CreateObject("ADODB.Connection")

dbConn = "DRIVER=SQL Server; SERVER="& dbhost &"; UID="& dbname_and_username &"; PWD="& dbpwd &"; Network Library=dbmssocn;"

oConn.Open(dbConn)

response.write "<br><br><center>The MS SQL connection has been opened.<br><br>"

 

oConn.Close

response.write "The MS SQL connection has been closed.</center>"

Set oConn = nothing

%>