SET CONNECTION

Selects the current session when in multi-session mode.

Syntax

SET CONNECTION {
    { session | DEFAULT } [DORMANT]
    | CURRENT DORMANT }
  1. 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. 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
  CONNECT TO "stores1"
  CONNECT TO "stores1" AS "SA"
  CONNECT TO "stores2" AS "SB"
  SET CONNECTION "stores1"    -- Select first session
  SET CONNECTION "SA"         -- Select second session
  SET CONNECTION "stores1"    -- Select first session again
END MAIN