CONNECT Statement [ESQL] [Interactive SQL]

Establishes a connection to the database identified by database-name running on the server identified by engine-name.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

Syntax 1

CONNECT
   … [ TO engine-name ]
   …[ DATABASE database-name ]
   …[ AS connection-name ]
   …[ USER ] useridIDENTIFIED BY ]

Syntax 2

CONNECT USING connect-string

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

Multiple connections are managed through the concept of a current connection. After a successful connect statement, the new connection becomes the current one. To switch to a different connection, use SET CONNECTION. Executing a CONNECT statement does not close the existing connection (if any). Use DISCONNECT to drop connections.

Static SQL statements use the user ID and password specified with the -l option on the SQLPP statement line. If no -l option is given, then the user ID and password of the CONNECT statement are used for static SQL statements also.

Standards

(back to top)

  • SQL—Vendor extension to ISO/ANSI SQL grammar.
  • SAP Sybase Database product—Open Client Embedded SQL supports a different syntax for the CONNECT statement.

Permissions

(back to top)

None

Related reference
DISCONNECT Statement [Interactive SQL]
GRANT CONNECT Statement
SET CONNECTION Statement [ESQL] [Interactive SQL]