ONE Active Server Pages Product Home Page Developer Site Version


Using System DSNs

As discussed in Creating Connection Strings, using a system DSN is one way to specify database information in a connection string.

Before you can use a system DSN in a connection string your administrator must first add it to the ASP Server, as described in Adding a DSN. This saves information on the ASP Server about all parameters required for connecting to the database.

Note icon Note On UNIX and Linux systems, Sun ONE Active Server Pages installs the ODBC drivers to support a number of databases. However, it does not support all databases on all platforms. To see the list of installed drivers for your platform, go to Supported in This Release.

Once a system DSN is configured, rather than specifying all of the database information in the connection string as you do with DSN-less connection strings, you can simply reference the system DSN name. When you do this, the ASP Server uses the information stored in the system DSN to establish the connection.

Often, all you need to provide in the connection string is the name of the DSN that your system administrator has configured for the database. In this case, use the following syntax:

connect_string = "dsn=[dsn_name]"

where [dsn_name] is the name your system administrator defined for the DSN.

However, if the username and password required for connecting to the database are not specified in the system DSN, you must include them in the connection string. Ask your database administrator for this information. Be sure to use the correct syntax for your type of database, as follows:

connect_string = "dsn=[dsn_name]; UID=[username]; PWD=[password]"
Note icon Note dBASE does not require a username and password.

If your system administrator asks you to use file DSNs or DSN-less connection strings rather than system DSNs, see Using File DSNs and Using DSN-less Connection Strings. However, you must use system DSNs for connecting to Microsoft Access and Microsoft SQL Server 6.5 databases. You cannot use DSN-less connection strings or file DSNs for connecting to these databases.

See also:

Connecting to a Database

Using FrontPage Database Features