7.5.28 SET CONNECTION

Table of Contents Previous Next


7 Reference : 7.5 ECPGPlus Statements : 7.5.28 SET CONNECTION

The syntax for the SET CONNECTION statement is:
EXEC SQL SET CONNECTION connection_name;
connection_name is the name of the connection to the database.
To use the SET CONNECTION statement, you should open the connection to the database using the second form of the CONNECT statement; include the AS clause to specify a connection_name.
By default, the current thread uses the current connection; use the SET CONNECTION statement to specify a default connection for the current thread to use. The default connection is only used when you execute an EXEC SQL statement that does not explicitly specify a connection name. For example, the following statement will use the default connection because it does not include an AT connection_name clause. :
EXEC SQL AT acctg_conn DELETE FROM emp;
The server will use the privileges associated with the connection when determining the privileges available to the connecting client. When using the acctg_conn connection, the client will have the privileges associated with the role, alice; when connected using hr_conn, the client will have the privileges associated with bob.

7 Reference : 7.5 ECPGPlus Statements : 7.5.28 SET CONNECTION

Table of Contents Previous Next