Progress
Embedded SQL-92
Guide and Reference
CONNECT Using a Connection Name
A CONNECT statement accepts a connect_string and a connection_name as arguments to establish a valid connection:
connect_string:
The string that specifies the database to which you are connecting. The connect_string must be either string literals enclosed in quotation marks or character-string C Language variables.
DEFAULT
The SQL engine attempts to connect to the environment-defined database. On both UNIX and Windows-NT platforms the value of the DB_NAME environment variable determines the
DEFAULT
connect_string.db_name
Name of the database.
progress:T:host_name:port_num:db_name
Connect to a Progress database.
Direct SQL to connect using the TCP/IP protocol for either a local or remote connection.
Specify the name of the system where the database resides. You can specify localhost for a local connection.
Number of the communications port where the SQL Server is running. Corresponds to the -S start-up parameter.
Name of the database.
connection_name
The name of the connection to use in
CONNECT
,DISCONNECT
andSET CONNECTION
statements. The connection_name must be either string literals enclosed in quotation marks or character-string C Language variables.If a
CONNECT
statement omits the optional connection_name, the SQL engine assigns a connection_name which is the same as the database name. Connection names must be unique.username
User name for authentication of the connection. The SQL engine verifies the username against a corresponding password before it connects to the database. On both UNIX and Windows-NT platforms, the value of the DH_USER environment variable determines the default username. If DH_USER is not set, the value of the USER environment variable determines the default username.
password
Password for authentication of the connection. The SQL engine verifies the password against a corresponding username before it connects to the database.
EXAMPLESThis example establishes a connection to a database using the connection_name conn_1:
The connection_name must be unique. If you do not specify a connection_name the value of the connect_string is used as the name of the connection.
For example, consider the above example without the connection_name specification. The connection is assigned the name of the value specified in the connect_string:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |