Q: What connection string can I use in my scripts to connect to my database?

NOTE : This FAQ article assumes you know how to write the necessary code to connect to, and read from, a database using ASP or ASP.NET, and ADO.

Here are a few example connection strings you can use to connect to a database using ASP or ASP.NET. If you want to use an ODBC DSN to connect to your database, you will first have to create the DSN through your Helm Control Panel. Replace the parts in BOLD with whatever is applicable to you.

(NOTE: AS OF JUL 2006, W2Kx-Web.com does not support ODBC connections - due to security and stability reasons)
1. MySQL or MS Access using DSN :

  • "DSN= DSNNAME ;Uid= USERID ;Pwd= PASSWORD ;"
2. MySQL using DSN-less connection :
  • "Driver={MySQL ODBC 3.51 Driver};Server=mysql.W2Kx-web.com;Uid= USERID ;Pwd= PASSWORD ;Database= DATABASE ;"
3. MS Access using DSN-less connection :
  • "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= DATABASE_PATH ;"

4. For a complete Access String on ASP pages, use the following:

<% Set cn=Server.CreateObject("ADODB.Connection")
cn.ConnectionTimeout=60
cn.Open"DSN=YOURDSN" %>

To close it, put this at the bottom of each page:

<% cn.Close
Set cn=Nothing %>

 

This is by no means a complete list. For more examples, please visit http://www.able-consulting.com .

Windows Server 2003
Helm
Frontpage
MySQL
ASP.NET
Microsoft Access
PHP
W2Kx-Web.com - Windows 2003 Server Web Hosting Solutions Web Hosting Plans Contact us about Web Hosting Web Hosting Support signup W2Kx-Web.com - Windows 2003 Server Web Hosting Solutions Plans Contact Support Control Panel Acceptable Use Policy Signup W2Kx-Web.com - Windows 2003 Server Web Hosting Solutions W2Kx-Web.com - Windows 2003 Server Web Hosting Solutions W2Kx-Web.com - Windows 2003 Server Web Hosting Solutions