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

 

Using DSN-less Connection Strings

As discussed in "Creating Connection Strings" in this chapter, using a DSN-less connection string is one way to specify the information (in the form of parameters and their values) that is needed for establishing a database connection. Unlike system DSNs and file DSNs, which incorporate this information by reference, DSN-less connection strings include all required database parameters.

You use the following syntax for a connection string:

connect_string = "[parameter_1=value_1; parameter_2=value_2; parameter_3=value_3]"

where [parameter_1=value1; parameter_2=value_2; parameter_3=value_3] specifies the required parameters for the given database.

The following example shows a DSN-less connection string for a MySQL database:

connect_string = "Driver={Mysql}; Server=[server_name]; Database=[database_name]; UID=[username]; PWD=[password]"

where [server_name] is the name of the database server, [database_name] is the name of the database, and [username] and [password] are the username and password required for accessing the database.

Different types of databases can require that you specify different parameters. The parameters to configure for each database in a DSN-less connection string are provided in "Syntax for 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.

Note about supported databases

With Sun Chili!Soft ASP for UNIX or Linux you cannot use DSN-less connection strings or file DSNs for connecting to Microsoft Access or Microsoft SQL Server 6.5 databases; you must use system DSNs for connecting to these databases.

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."

See also:

Connecting to a Database in this chapter

Creating Connection Strings in this chapter

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