SET CONNECTION

Function

The SET CONNECTION statement is used to specify which database connection to use for subsequent SQL statements.

Invocation

 

Embedded Mode  P

Dynamic Mode  

Interactive Mode  P

 

Syntax

 


          set_connection.bmp

 

Description

 

SET CONNECTION connection_name

 

connection_name

   

The value for connection_name must match the connection name of an

existing database connection specified in a previous CONNECT TO statement.

   

The connection_name can be either a literal or a host variable.

 

ANSI Specifics

The SET CONNECTION statement is not part of the ANSI standard.

Adabas SQL Gateway Embedded SQL Specifics

None.

 

Example

EXEC SQL CONNECT TO EMPLOYEES AS S1 USER U1;

EXEC SQL CONNECT TO VEHICLES  AS S2 USER U1;

EXEC SQL SET CONNECTION 'S1';

EXEC SQL SELECT PERSONNEL_ID FROM EMPLOYEES INTO :PERSONNEL_ID;

EXEC SQL SET CONNECTION 'S2';

EXEC SQL SELECT MAKE FROM VEHICLES INTO :MAKE;

EXEC SQL DISCONNECT 'S1';

EXEC SQL DISCONNECT 'S2';