set connection

Description

Causes the specified existing connection to become the current connection.

Syntax

set connection {connection_name | DEFAULT} end-exec

Parameters

connection_name

The name of an existing connection that you want to become the current connection.

default

Specifies that the unnamed default connection is to become the current connection.

Examples

Example 1

 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
           01     MYID     PIC X(33).
      EXEC SQL END DECLARE SECTION END-EXEC.
 
           ...
 
      EXEC SQL CONNECT "user1" AT connect1 USING "SERVER1" END-EXEC.
      EXEC SQL CONNECT "user2" AT connect2 USING "SERVER2" END-EXEC.
 
 * The next statement executes on connect2, because that was the 
 * last connection made.
 
      EXEC SQL SELECT user_name() INTO :MYID END-EXEC.
 
      DISPLAY "The user connected to SERVER2 is: ",MYID.
 
 * Explicitly set the connection to now use to connect1.
 
      EXEC SQL SET CONNECTION connect1 END-EXEC.
 
 * The following statement will execute on connect1.
 
      EXEC SQL SELECT user_name() INTO :MYID END-EXEC.
 
      DISPLAY "The user connected to SERVER1 is: ",MYID.

Usage

See also

at connection_name, connect