SET CONNECTION
Selects the current session when in multi-session mode.
Syntax
SET CONNECTION {
{
session |
DEFAULT }
[
DORMANT]
|
CURRENT DORMANT }
- session is a string expression identifying the name of the database session to be set as current.
Usage
The SET CONNECTION
instruction
makes a given connection current.
The session name is case-sensitive.
When using the DEFAULT
keyword, it identifies the default database server
connection established with a CONNECT TO DEFAULT
or a DATABASE
instruction.
The DEFAULT
clause of SET CONNECTION
is specific to IBM® Informix®.
To make the current connection dormant, use CURRENT DORMANT
keyword.
The DORMANT
clause of SET CONNECTION
is specific to IBM Informix.
A SET CONNECTION
statement cannot be executed with dynamic SQL
(PREPARE
+ EXECUTE
).
Example
MAIN
DEFINE c1, c2, c3 INT
CONNECT TO "stores1"
CONNECT TO "stores2" AS "SA"
CONNECT TO "stores3" AS "SB"
SET CONNECTION "stores1" -- Select first session
SELECT COUNT(*) INTO c1 FROM customers
SET CONNECTION "SA" -- Select second session
SELECT COUNT(*) INTO c2 FROM customers
SET CONNECTION "SB" -- Select third session
SELECT COUNT(*) INTO c3 FROM customers
SET CONNECTION "stores1" -- Select first session again
END MAIN