The Db2 driver supports reauthentication for Db2 for Linux/UNIX/Windows. The user performing the switch must have been granted the database SETSESSIONUSER permission and the SYSADM permission.

Note: Before performing reauthentication, applications must ensure that any statements or result sets created for one user are closed before switching the connection to another user.

Use the setCurrentUser() method in the ExtConnection interface to switch a user on a connection. The following table describes the driver-specific options supported by the setCurrentUser() method.

Table 1. ExtConnection.setCurrentUser() Options
Option Description
CURRENT_SCHEMA Specifies the name of the current schema. The value must be a valid Db2 schema name.

If the setCurrentUser() method is called and this option is not specified or the value is set to #USER#, the schema is switched to the schema of the current user. If the setCurrentUser() method is called and this option is specified as an empty string, only the user is switched; the schema is not switched.

CURRENT_PATH Specifies the current path for the database to use when locating stored procedures and functions. The value must be a valid path name for the Db2 CURRENT PATH special register.

If the setCurrentUser() method is called and this option is not specified or the value is set to #USER#, the path is switched to the path of the current user. If the setCurrentUser() method is called and this option is specified as an empty string, only the user is switched; the path is not switched.

Refer to Connection Pool Manager in the Progress DataDirect for JDBC Drivers Reference for more information.

Refer to JDBC extensions in the Progress DataDirect for JDBC Drivers Reference for more information about the setCurrentUser() method.