Database connections / Multi-session mode connection instructions |
Selects the current session when in multi-session mode.
SET CONNECTION { { session | DEFAULT } [DORMANT] | CURRENT DORMANT }
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. This clause is specific to IBM® Informix® databases.
To make the current connection dormant, use CURRENT DORMANT keyword. This clause is specific to IBM Informix databases.
A SET CONNECTION statement cannot be executed with dynamic SQL (i.e. PREPARE + EXECUTE).
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