Progress
SQL-92
Guide and Reference


CONNECT Statement

Establishes a connection to a database. Optionally, the CONNECT statement can also specify a name for the connection and a username and password for authentication.

SYNTAX

CONNECT TO connect_string 
  [ AS connection_name ] 
  [ USER username ] 
  [ USING password ] ; 

connect_string

SYNTAX
{  DEFAULT  |  db_name  |  db_type:T:host_name:port_num:db_name  } 

NOTE: Arguments to CONNECT must be either string literals enclosed in quotation marks or character-string host variables.

connect_string

Specifies to which database to connect. If the CONNECT statement specifies DEFAULT, SQL tries to connect to the environment-defined database, if any. The value of the DB_NAME environment variable specifies the default connect string.

The connect_string can be a simple database name or a complete connect_string. A complete connect string has the following components:

Connect String
Description
db_type 
Type of database. The only currently supported database type is 'progress.'
T 
T directs the SQL engine to use the TCP/IP protocol.
host_name 
Name of the system where the database resides.
port_num 
Port number to use for the connection.
db_name 
Name of the database.

connection_name

The name of the connection as either a character literal or host variable. If the CONNECT statement omits a connection name, the default is the name of the database. Connection names must be unique.

username

User name for authentication of the connection. SQL verifies the user name against a corresponding password before it connects to the database. The value of the DH_USER environment variable specifies the default user name. If DH_USER is not set, the value of the USER environment variable specifies the default user name.

password

Password for authentication of the connection. SQL verifies the password against a corresponding user name before it connects to the database.

The value of the DH_PASSWD environment variable determines the default password.

NOTES

EXAMPLES

The following examples illustrate the CONNECT statement:

See also the last example for the DISCONNECT Statement which illustrates the CONNECT, SET CONNECTION, and DISCONNECT statements in combination.

AUTHORIZATION

None

SQL COMPLIANCE

SQL-92

ENVIRONMENT

Embedded SQL only

RELATED STATEMENTS

DISCONNECT Statement, SET CONNECTION Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095