The DB2 driver supports reauthentication for the following databases:
DB2 V9.1 and higher for Linux/UNIX/Windows. The user performing the switch must have been granted the database SETSESSIONUSER permission.
DB2 V8.1.4 and higher for Linux/UNIX/Windows. The user performing the switch must have been granted the SYSADM permission.
See Using Reauthentication for an introduction to reauthentication. Refer to "Connection Pool Manager" in the DataDirect Connect Series for JDBC Reference for information about using reauthentication with the DataDirect Connection Pool Manager.
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 28. 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 "JDBC Extensions" in the DataDirect Connect Series for JDBC Reference for more information about the setCurrentUser() method.