SET CONNECTION statement [DBISQL] [ESQL]

Description

Changes the active database connection.

Syntax

SET CONNECTION [connection-name]

Parameters

connection-name:

identifier, string or host-variable

Examples

Example 1

In Embedded SQL:

EXEC SQL SET CONNECTION :conn_name

Example 2

From dbisql, sets the current connection to the connection named “conn1”:

SET CONNECTION conn1 

Usage

The current connection state is saved and is resumed when it again becomes the active connection. If connection-name is omitted and there is a connection that was not named, that connection becomes the active connection.

NoteWhen cursors are opened in Embedded SQL, they are associated with the current connection. When the connection is changed, the cursor names are not accessible. The cursors remain active and in position and become accessible when the associated connection becomes active again.


Side effects

None

Standards

Permissions

None

See also

CONNECT statement [ESQL] [DBISQL]

DISCONNECT statement [DBISQL]