The com.ibm.db2.jcc.DB2PooledConnection class provides methods that an application server can use to switch users on a preexisting trusted connection.
The following methods are defined only for the IBM Data Server Driver for JDBC and SQLJ.
public DB2Connection getConnection()
throws java.sql.SQLException
This method is for dirty reuse of a connection. This means that the connection state is not reset when the object is reused from the pool. Special register settings and property settings remain in effect unless they are overridden by passed properties. Global temporary tables are not deleted. Properties that are not specified are not re-initialized. All JDBC standard transient properties, such as the isolation level, autocommit mode, and read-only mode are reset to their JDBC defaults. Certain properties, such as user, password, databaseName, serverName, portNumber, planName, and pkList remain unchanged.
public DB2Connection getDB2Connection(byte[] cookie,
String user,
String password,
String userRegistry,
byte[] userSecToken,
String originalUser,
java.util.Properties properties)
throws java.sql.SQLException
public Connection getDB2Connection(byte[] cookie,
org.ietf.GSSCredential gssCredential,
String usernameRegistry,
byte[] userSecToken,
String originalUser,
java.util.Properties properties)
throws java.sql.SQLException
Switches the user that is associated with a trusted connection without authentication.
The second form of getDB2Connection is supported only for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity.
public DB2Connection getDB2Connection(
String user,
String password,
java.util.Properties properties)
throws java.sql.SQLException
public DB2Connection getDB2Connection(org.ietf.jgss.GSSCredential gssCredential,
java.util.Properties properties)
throws java.sql.SQLException
Switches the user that is associated with a untrusted connection, with authentication.
The first form getDB2Connection provides a user ID and password. The second form of getDB2Connection is for connections that use Kerberos security.
public java.sql.Connection getDB2Connection(
java.util.Properties properties)
throws java.sql.SQLException
Reuses an untrusted connection, without reauthentication.
This method is for dirty reuse of a connection. This means that the connection state is not reset when the object is reused from the pool. Special register settings and property settings remain in effect unless they are overridden by passed properties. Global temporary tables are not deleted. Properties that are not specified are not re-initialized. All JDBC standard transient properties, such as the isolation level, autocommit mode, and read-only mode are reset to their JDBC defaults. Certain properties, such as user, password, databaseName, serverName, portNumber, planName, and pkList remain unchanged.