The Web Design Team's WDTzine Presents...

Databases on the Web
Connection Strings for VBScript

Connecting to Your Database

DSN-Less Connection Strings

DSN-less connection strings can be added to your ASP code scripts and changed at your discretion without intervention administrator access to your webserver.

If you have a choice of using a System DSN or DSN-less connection, be sure to use a DSN-less connection, which has been shown to demonstrate better performance with many concurrent connections see: http://www.4guysfromrolla.com/webtech/063099-1.shtml

MS Access 2000/2002

Virtual Path (Recommended) DSN_NAME = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/database/database.mdb"

Absolute Path DSN_NAME = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\websites\www.yourdomain.com\database\database.mdb"

MS Access 97

Virtual Path (Recommended) DSN_NAME = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/database/database.mdb") MS Access 97
Absolute Path DSN_NAME = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\websites\www.yourdomain.com\database\database.mdb"

MS SQL Server 7 or 2000

OLEDB connection

DSN_NAME= "Provider=SQLOLEDB;Data Source=SERVER_NAME;database=DB_NAME;uid=UID;pwd=PWD;"

MS SQL Server 7 or 2000 - ODBC connection DSN_NAME = "driver={SQL Server};server=SERVER_NAME;uid=UID;pwd=PWD;database=DB_NAME" MySQL DSN_NAME = "driver=MySQL;server=SERVER_IP;uid=UID;pwd=PWD;database=DB_NAME

Creating a DSN Connection

First you need to create the DSN connection in Windows 2000 or XP you need to open Administrative Tools – Data Source and create the connection there.

To connect on your page add the following code
oConn.Open "DSN=mySystemDSN;" & _ "Uid=myUsername;" & _ "Pwd=myPassword"

References

Database Performance

Connection Strings – If you can’t find the connection string or driver you need at Able Consulting it probably doesn’t exist.

Back to Top
Copyright 1999-2003 All rights reserved.
WiserWays - Cheryl D. Wise