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

 

Syntax for DSN-less Connection Strings

The following table lists the parameters to define and the syntax to use for each type of database in DSN-less connection strings.

Database Type

Syntax for DSN-less Connection Strings

DB2

connect_string = "Driver={DB2}; IP=[ip_address]; Port=[port_number]; Database=[database_name]; UID=[username]; PWD=[password]"

where [ip_address] is the IP address of the database server, [port_number] is the port for 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.

dBASE 5

connect_string = "Driver={Dbase}; DBQ=[pathname]; defaultDir=[default_directory]"

where [pathname] is the absolute path name of the directory containing the database file and [default_directory] is the default directory for the database.

Informix 7, 9

connect_string = "Driver={Informix}; ServerName=[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.

Informix 2000

connect_string = "Driver={Informix}; HostName=[host_name]; ServerName=[server_name]; Port=[port_number];Database=[database_name]; UID=[username]; PWD=[password]"

where [host_name] is the name of the computer on which the database server resides, [server_name] is the name of the database server as it appears in the sqlhosts file, [port_number] is the port on which the database server is configured to listen, [database_name] is the name of the database, and [username] and [password] are the username and password required for accessing the database.

Microsoft Access

DSN-less connection strings and file DSNs are not supported for Microsoft Access databases. You must use system DSNs.

Microsoft SQL Server 6.5

DSN-less connection strings and file DSNs are not supported for Microsoft SQL Server 6.5 databases. You must use system DSNs.

Microsoft SQL Server 7.0 and 2000

connect_string = "Driver={SQL Server}; Database=[database_name]; Address=[ip_address],[port_number]; UID=[username]; PWD=[password]"

where [database_name] is the name of the database, [ip_address],[port_number] is the IP address of the database server and the port on which the database server is configured to listen, and [username] and [password] are the username and password required for accessing the database.

MySQL

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.

Oracle 7, 8

connect_string = " Driver={Oracle}; Server=[TNS_name]; UID=[username]; PWD=[password]"

where [TNS_name] is the TNS name as defined in the tnsnames.ora file, and [username] and [password] are the username and password required for accessing the database.

Oracle 8i, 9i

connect_string = " Driver={Oracle}; Host=[host_name];Port=[port_number]; SID=[oracle_SID]; UID=[username]; PWD=[password]"

where [host_name] is the computer on which the database server resides, [port_number] is the port on which the database server is configured to listen, [oracle_SID] is the Oracle System Identifier that refers to the instance of Oracle running on the server, and [username] and [password] are the username and password required for accessing the database.

PostgreSQL

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

where [server_name] is the name of the database server, [port_number] is the port on which the database server is configured to listen, [database_name] is the name of the database, and [username] and [password] are the username and password required for accessing the database.

Sybase

connect_string = " Driver={Sybase}; NetworkAddress=[host_name],[port_number]; Database=[database_name]; UID=[username]; PWD=[password]"

where [host_name],[port_number] is the IP address of the database server and the port on which the database server is configured to listen, [database_name] is the name of the database,; and [username] and [password] are the username and password required for accessing the database.

Text

connect_string = " Driver={Text}; Database=[database_location]"

where [database_location] is the directory in which the text files are stored.

See also:

Using DSN-less Connection Strings in this chapter

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