7.5.28 SET CONNECTION
7.5.28 SET CONNECTIONThere are (at least) three reasons you may need more than one connection in a given client application:
• 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. :This statement will not use the default connection because it specifies a connection name using the AT connection_name clause:Can change between the connections with the SET CONNECTION statement: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.