SET CONNECTION
The SET CONNECTION statement activates a specified connection.
General format
EXEC SQL [ AT Database ] SET CONNECTION { Connection-name } END-EXEC |
Syntax rules
General rules
1. When two or more connections are opened you can choose the active connection using the Connection-Name parameter.
2. Database identifies the active connection that will execute the query and must be previously defined using a Format 4
DECLARE statement.
Examples
Switch from one connection to another when having one connection to an Oracle DB and other to a MySQL DB
if db-to-use = ora-db exec sql set connection ora-conn-1 end-exec else exec sql set connection mysql-conn-2 end-exec end-if |