Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

Creating Connection Strings

When you want to connect to a database from an ASP page, your first step is to create the connection string. This provides information (in the form of parameters and their values) that is required for the server to establish the connection.

Each type of database has a specific set of parameters for which you must specify values; these are the required parameters. Some databases also provide optional parameters that you can specify to implement special features.

Exactly what you must include in a connection string depends on the type of database and the approach you use to specify its parameters. Sun Chili!Soft ASP supports the following three approaches to specifying parameters in a connection string:

   System DSNs. With a system DSN, all you need to provide in the connection string is the name of the DSN that your system administrator has configured for the database on the ASP Server. For more information, see "Using System DSNs" in this section.

   File DSNs. A file DSN is similar to a system DSN, except the database information is contained in a file (*.dsn) that can be stored in the root directory for a virtual host, rather than being stored centrally by the ASP Server. File DSNs are useful in shared Web hosting environments because a system administrator does not need to configure each file DSN; users can configure their own. For more information, see "Using File DSNs" in this section.

   DSN-less connection strings. With a DSN-less connection string, you specify all of the required database information in the connection string. For more information, see "Using DSN-less Connection Strings" in this section.

Note about using Windows connection strings with Sun Chili!Soft ASP for UNIX or Linux

Connection strings must be constructed according to the requirements of the ODBC driver being used. Sun Chili!Soft ASP for Windows uses standard Windows ODBC drivers, so connection strings you developed for Windows will work. However, the ODBC drivers for UNIX and Linux platforms are different than for Windows, so before you can use Windows connection strings with Sun Chili!Soft ASP for UNIX or Linux, you must edit them to use the syntax described in this section.

When creating file system references in ASP applications, keep in mind that UNIX and Linux are case-sensitive operating systems. Be sure to use the correct capitalization in all references to files and directories.

Ask your server administrator which approach you should use in your specific Web server environment.

Once you have created the connection string in your ASP page, you can add the code needed to open a database connection, as described in "Opening the Database Connection" in this chapter.

Note

On UNIX and Linux systems, Sun Chili!Soft ASP 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 the platform-specific installation requirements section in "Installing and Uninstalling Sun Chili!Soft ASP" in "Chapter 2: Installing and Configuring Sun Chili!Soft ASP."

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.