. Hostway Online Manual - (Windows® 2000      


2.6.1  “DSN-less” Connections

You can open a connection to a database without creating or specifying a named data source. Connections made in this way are called “DSN-less,” because they don’t require the creation of an ODBC DSN. Rather than relying on information stored in a file or in the system registry, DSN-less connections specify the driver name, and all driver-specific information in the connection string.

The following DSN-less connection strings contain the minimum parameters required
by the ODBC drivers of Microsoft Access:

Using Microsoft Access DNS-Less Connection
<%
Set Cnn = Server.CreateObject("ADODB.Connection")

strConAccess = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\wwwroot\domaincom\database\database.mdb"
Cnn.open StrConAccess
%>
Using Microsoft Access DNS-Less Connection with Password
<%
Set Cnn = Server.CreateObject("ADODB.Connection")

strConAccess = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\wwwroot\domaincom\database\database.mdb; Password=YourDBPassword"
Cnn.open StrConAccess
%>
Using Microsoft Access OLE DB Connection
<% Set Cnn = Server.CreateObject("ADODB.Connection")
strConAccess = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=D:\wwwroot\domaincom\database\database.mdb"
Cnn.open strConAccess
 %>
The following DSN-less connection strings contain the minimum parameters required
by the ODBC drivers of Microsoft SQL Server 2000 (Windows 2000 Platinum and Commerce Platinum Plans Only):
Using Microsoft SQL Server 2000 DSN-Less Connection
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={SQL Server};SERVER=mssql.domain.com;UID=USER;PWD=password;DATABASE=mydatabase"
Conn.open DSNtest
%>
Using Microsoft SQL Server 2000 OLE DB Connection
<% Set cnn = Server.CreateObject("ADODB.Connection") cnn.open "PROVIDER=SQLOLEDB;DATA SOURCE=mssql.domain.com;UID=username;PWD=password;DATABASE=mydatabase " %>
The following DSN-less connection strings contain the minimum parameters required
by the ODBC drivers of Microsoft Fox Pro Database:

Using Microsoft Fox Pro DSN-Less Connection
<%
Set Conn = Server.CreateObject("ADODB.Connection")
ConnStr= "Driver=Microsoft Visual Foxpro Driver; UID=userID;SourceType=DBC;SourceDB=D:\wwwroot\mydatabase.dbc"
Conn.Open ConnStr
%>

Essentially, a DSN-less connection is “hard-coded” to use a certain driver, user identity, and database location, which makes it difficult to update when the database parameters change. Because the variety of connection parameters can differ greatly from one ODBC data source drive to another, it is recommended that you use a DSN whenever possible. If you need a DSN connection please login into SiteControl, go to Domain Manager, Add Features and Select Microsoft Access ODBC Connection (DSN).


Copyright©2000-2001 Hostway Corp. All rights reserved.     Privacy Statement     Terms of Use