The com.ibm.db2.jcc.DB2Connection interface extends the java.sql.Connection interface.
The following methods are defined only for the IBM® Data Server Driver for JDBC and SQLJ.
public boolean alternateWasUsedOnConnect()
throws java.sql.SQLException
Returns true if the driver used alternate server information to obtain the connection. The alternate server information is available in the transient clientRerouteServerList information on the DB2BaseDataSource, which the database server updates as primary and alternate servers change.
public abstract void changeDB2Password(String oldPassword,
String newPassword)
throws java.sql.SQLException
Changes the password for accessing the data source, for the user of the Connection object.
Array createArrayOf(String typeName,
Object[] elements)
throws SQLException;
Creates a java.sql.Array object.
Struct createStruct(String typeName,
Object[] attributes)
throws SQLException;
Returns a java.sql.Struct object that maps to typeName and has the attributes that are specified by attributes.
public void deregisterDB2XmlObject(String sqlIdSchema,
String sqlIdName)
throws SQLException
Removes a previously registered XML schema from the data source.
public String getDB2ClientAccountingInformation()
throws SQLException
Returns accounting information for the current client.
Important: getDB2ClientAccountingInformation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
public String getDB2ClientApplicationInformation()
throws java.sql.SQLException
Returns application information for the current client.
Important: getDB2ClientApplicationInformation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
public String getDB2ClientCorrelationToken()
throws SQLException
Returns the client correlation token for the current client.
getDB2ClientCorrelationToken applies only to connections to DB2® for z/OS®.
Important: getDB2ClientCorrelationToken is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
public String getDB2ClientProgramId()
throws java.sql.SQLException
Returns the user-defined program identifier for the client. The program identifier can be used to identify the application at the data source.
getDB2ClientProgramId does not apply to DB2 for Linux, UNIX, and Windows data servers.
public String getDB2ClientUser()
throws java.sql.SQLException
Returns the current client user name for the connection. This name is not the user value for the JDBC connection.
Important: getDB2ClientUser is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
public String getDB2ClientWorkstation()
throws java.sql.SQLException
Returns current client workstation name for the current client.
Important: getDB2ClientWorkstation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
String getDB2Correlator()
throws java.sql.SQLException
Returns the value of the crrtkn (correlation token) instance variable that DRDA® sends with the ACCRDB command. The correlation token uniquely identifies a logical connection to a server.
public String getDB2CurrentPackagePath()
throws java.sql.SQLException
Returns the list of DB2 package collections that are searched for JDBC and SQLJ packages.
The getDB2CurrentPackagePath method applies only to connections to DB2 database systems.
public String getDB2CurrentPackageSet()
throws java.sql.SQLException
Returns the collection ID for the connection.
The getDB2CurrentPackageSet method applies only to connections to DB2 database systems.
public int getDB2ProgressiveStreaming()
throws java.sql.SQLException
Returns the current progressive streaming setting for the connection.
public int getDB2SecurityMechanism()
throws java.sql.SQLException
public abstract DB2SystemMonitor getDB2SystemMonitor()
throws java.sql.SQLException
Returns the system monitor object for the connection. Each IBM Data Server Driver for JDBC and SQLJ connection can have a single system monitor.
public int getDBConcurrentAccessResolution()
throws java.sql.SQLException
Returns the concurrent access setting for the connection. The concurrent access setting is set by the setDBConcurrentAccessResolution method or by the concurrentAccessResolution property.
getDBConcurrentAccessResolution applies only to connections to DB2 for z/OS and DB2 for Linux, UNIX, and Windows.
public int getDB2ProgressiveStreaming()
throws java.sql.SQLException
Returns the current progressive streaming setting for the connection.
public int getDBStatementConcentrator()
throws java.sql.SQLException
Returns the statement concentrator use setting for the connection. The statement concentrator use setting is set by the setDBStatementConcentrator method or by the statementConcentrator property.
public PrintWriter getJccLogWriter()
throws java.sql.SQLException
Returns the current trace destination for the IBM Data Server Driver for JDBC and SQLJ trace.
public java.util.Properties getJccSpecialRegisterProperties()
throws java.sql.SQLException
Returns a java.util.Properties object, in which the keys are the special registers that are supported at the target data source, and the key values are the current values of those special registers.
This method does not apply to connections to IBM Informix® data sources.
public boolean getSavePointUniqueOption()
throws java.sql.SQLException
Returns true if setSavePointUniqueOption was
most recently called with a value of true.
Returns false otherwise.public void DB2Connection.installDB2JavaStoredProcedure(
java.io.InputStream jarFile,
int jarFileLength,
String jarId)
throws java.sql.SQLException
Invokes the sqlj.install_jar stored procedure on a DB2 for Linux, UNIX, and Windows server to create a new definition of a JAR file in the catalog for that server.
This method does not apply to connections to IBM Informix data sources.
public boolean DB2Connection.isDB2Alive()
throws java.sql.SQLException
Returns true if the socket for a connection to the data source is still active.
Important: isDB2Alive is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use Connection.isDBValid instead.
public boolean DB2Connection.isDBValid(boolean throwException, int timeout)
throws java.sql.SQLException
Returns true if the connection has not been closed and is still valid. Returns false otherwise.
For IBM Data Server Driver for JDBC and SQLJ type 4 connectivity, isDBValid throws an SQLException if the value of timeout is less than 0.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity, isDBValid throws an SQLException if the value of timeout is not equal to 0.
This method does not apply to connections to IBM Informix data sources.
public java.sql.PreparedStatement
DB2Connection.prepareDB2OptimisticLockingQuery(String sql,
int returnOptimisticLockingColumns)
throws SQLException
Creates a PreparedStatement object that can request optimistic locking information.
Value | Description |
---|---|
DB2Statement.RETURN_OPTLOCK_COLUMN_NONE (0) | Do not return optimistic locking columns. |
DB2Statement.RETURN_OPTLOCK_COLUMN_ALWAYS (1) | Add row change columns to the result set even if they do not uniquely represent a single row. This setting is equivalent to the database prepare attribute WITH ROW CHANGE COLUMNS POSSIBLY DISTINCT. |
DB2Statement.RETURN_OPTLOCK_COLUMN_NO_FALSE_NEGATIVES (2) | Add row change columns to the result set only if they uniquely represent a single row. This setting is equivalent to the database prepare attribute WITH ROW CHANGE COLUMNS ALWAYS DISTINCT. |
public void reconfigureDB2Connection(java.util.Properties properties)
throws SQLException
Reconfigures a connection with new settings. The connection does not need to be returned to a connection pool before it is reconfigured. This method can be called while a transaction is in progress, and can be used for trusted or untrusted connections.
public void registerDB2XmlSchema(String[] sqlIdSchema,
String[] sqlIdName,
String[] xmlSchemaLocations,
InputStream[] xmlSchemaDocuments,
int[] xmlSchemaDocumentsLengths,
InputStream[] xmlSchemaDocumentsProperties,
int[] xmlSchemaDocumentsPropertiesLengths,
InputStream xmlSchemaProperties,
int xmlSchemaPropertiesLength,
boolean isUsedForShredding)
throws SQLException
public void registerDB2XmlSchema(String[] sqlIdSchema,
String[] sqlIdName,
String[] xmlSchemaLocations,
String[] xmlSchemaDocuments,
String[] xmlSchemaDocumentsProperties,
String xmlSchemaProperties,
boolean isUsedForShredding)
throws SQLException
Registers an XML schema with one or more XML schema documents. If multiple XML schema documents are processed with one call to registerDB2XmlSchema, those documents are processed as part of a single transaction.
The first form of registerDB2XmlSchema is for XML schema documents that are read from an input stream. The second form of registerDB2XmlSchema is for XML schema documents that are read from strings.
This method does not apply to connections to IBM Informix data sources.
public void setDBConcurrentAccessResolution(int concurrentAccessResolution)
throws java.sql.SQLException
Specifies whether the IBM Data Server Driver for JDBC and SQLJ requests
that a read transaction can access a committed and consistent image
of rows that are incompatibly locked by write transactions, if the
data source supports accessing currently committed data, and the application
isolation level is cursor stability (CS) or read stability (RS). This
option has the same effect as the DB2 CONCURRENTACCESSRESOLUTION
bind option. setDBConcurrentAccessResolution affects
only statements that are created after setDBConcurrentAccessResolution is
executed.setDBConcurrentAccessResolution applies only to connections to DB2 for z/OS and DB2 for Linux, UNIX, and Windows.
public void setDB2ProgressiveStreaming(int newSetting)
throws java.sql.SQLException
Sets the progressive streaming setting for all ResultSet objects that are created on the connection.
public void setDBStatementConcentrator(int statementConcentratorUse)
throws java.sql.SQLException
Specifies whether the IBM Data Server Driver for JDBC and SQLJ uses
the data source's statement concentrator functionality. The statement
concentrator is the ability to bypass preparation of a statement when
it is the same as a statement in the dynamic statement cache, except
for literal values. Statement concentrator functionality applies only
to SQL statements that have literals but no parameter markers. setDBStatementConcentrator overrides
the setting of the statementConcentrator Connection or DataSource property. setDBStatementConcentrator affects
only statements that are created after setDBStatementConcentrator is
executed.For DB2 for Linux, UNIX, and Windows data sources that support statement concentrator functionality, the functionality is used if the STMT_CONC configuration parameter is set to ON at the data source. Otherwise, statement concentrator functionality is not used.
For DB2 for z/OS data sources that support statement concentrator functionality, the functionality is not used if statementConcentrator is not set.
public void DB2Connection.removeDB2JavaStoredProcedure(
String jarId)
throws java.sql.SQLException
Invokes the sqlj.remove_jar stored procedure on a DB2 for Linux, UNIX, and Windows server to delete the definition of a JAR file from the catalog for that server.
This method does not apply to connections to IBM Informix data sources.
public void DB2Connection.replaceDB2JavaStoredProcedure(
java.io.InputStream jarFile,
int jarFileLength,
String jarId)
throws java.sql.SQLException
Invokes the sqlj.replace_jar stored procedure on a DB2 for Linux, UNIX, and Windows server to replace the definition of a JAR file in the catalog for that server.
This method does not apply to connections to IBM Informix data sources.
public void reuseDB2Connection(byte[] cookie,
String user,
String password,
String usernameRegistry,
byte[] userSecToken,
String originalUser,
java.util.Properties properties)
throws java.sql.SQLException
public void reuseDB2Connection(byte[] cookie,
org.ietf.GSSCredential gssCredential,
String usernameRegistry,
byte[] userSecToken,
String originalUser,
java.util.Properties properties)
throws java.sql.SQLException
The second of these forms of reuseDB2Connection does not apply to IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS.
These forms of reuseDB2Connection are used by a trusted application server to reuse a preexisting trusted connection on behalf of a new user. Properties that can be reset are passed, including the new user ID. The database server resets the associated physical connection. If reuseDB2Connection executes successfully, the connection becomes available for immediate use, with different properties, by the new user.
public void reuseDB2Connection(String user,
String password,
java.util.Properties properties)
throws java.sql.SQLException
public void reuseDB2Connection(
org.ietf.jgss.GSSCredential gssCredential,
java.util.Properties properties)
throws java.sql.SQLException
The first of these forms of reuseDB2Connection is not supported for IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS.
The second of these forms of reuseDB2Connection does not apply to IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS.
In a heterogeneous pooling environment, these forms of reuseDB2Connection reuse an existing Connection instance after reauthentication.
public void reuseDB2Connection(java.util.Properties properties)
throws java.sql.SQLException
Reuses an existing Connection instance without reauthentication. This method is intended for reuse of a Connection instance when the properties do not change.
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 void setDB2ClientAccountingInformation(String info)
throws java.sql.SQLException
Specifies accounting information for the connection. This information is for client accounting purposes. This value can change during a connection.
setDB2ClientAccountingToken applies only to connections to DB2 for z/OS.
The maximum length depends on the data server version. See Client info properties support by the IBM Data Server Driver for JDBC and SQLJ for the maximum lengths.
A Java™ empty string ("") or a Java null value is valid for this parameter.
Important: setDB2ClientAccountingInformation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.setClientInfo instead.
public String setDB2ClientApplicationInformation(String info)
throws java.sql.SQLException
Specifies application information for the current client.
Important: setDB2ClientApplicationInformation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.setClientInfo instead.
The maximum length depends on the data server version. See Client info properties support by the IBM Data Server Driver for JDBC and SQLJ for the maximum lengths.
A Java empty string ("") or a Java null value is valid for this parameter.
public String setDB2ClientCorrelationToken(String client-correlation-token)
throws SQLException
Specifies a unique value that allows you to correlate your business processes across the enterprise.
Important: setDB2ClientCorrelationToken is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.setClientInfo instead.
public void setDB2ClientDebugInfo(String debugInfo)
throws java.sql.SQLException
public void setDB2ClientDebugInfo(String mgrInfo,
String traceInfo)
throws java.sql.SQLException
Sets a value for the CLIENT DEBUGINFO connection attribute, to notify the database system that stored procedures and user-defined functions that are using the connection are running in debug mode. CLIENT DEBUGINFO is used by the DB2 Unified Debugger. Use the first form to set the entire CLIENT DEBUGINFO string. Use the second form to modify only the session manager and trace information in the CLIENT DEBUGINFO string.
Mip:port,Iip,Ppid,Ttid,Cid,Llvl
The
parts of the string are: M9.72.133.89:8355,I9.72.133.89,P4552,T123,C1,L0
See
the description of SET CLIENT DEBUGINFO for a detailed description
of this string.Mip:port
For
example: M9.72.133.89:8355
See the description
of SET CLIENT DEBUGINFO for a detailed description of this string.Llvl
For
example: L0
See the description of SET CLIENT
DEBUGINFO for a detailed description of this string.public abstract void setDB2ClientProgramId(String program-ID)
throws java.sql.SQLException
Sets a user-defined program identifier for the connection, on DB2 for z/OS servers. That program identifier is an 80-byte string that is used to identify the caller.
setDB2ClientProgramId does not apply to DB2 for Linux, UNIX, and Windows or IBM Informix data servers.
The DB2 for z/OS server places the string in IFCID 316 trace records along with other statistics, so that you can identify which program is associated with a particular SQL statement.
public void setDB2ClientUser(String user)
throws java.sql.SQLException
Specifies the current client user name for the connection. This name is for client accounting purposes, and is not the user value for the JDBC connection. Unlike the user for the JDBC connection, the current client user name can change during a connection.
The maximum length depends on the data server version. See Client info properties support by the IBM Data Server Driver for JDBC and SQLJ for the maximum lengths.
A Java empty string ("") or a Java null value is valid for this parameter.
Important: setDB2ClientUser is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.setClientInfo instead.
public void setDB2ClientWorkstation(String name)
throws java.sql.SQLException
Specifies the current client workstation name for the connection. This name is for client accounting purposes. The current client workstation name can change during a connection.
The maximum length depends on the data server version. See Client info properties support by the IBM Data Server Driver for JDBC and SQLJ for the maximum lengths.
A Java empty string ("") or a Java null value is valid for this parameter.
Important: getDB2ClientWorkstation is deprecated in the JDBC 4.0 implementation of the IBM Data Server Driver for JDBC and SQLJ. Use java.sql.Connection.getClientInfo instead.
public void setDB2CurrentPackagePath(String packagePath)
throws java.sql.SQLException
Specifies a list of collection IDs that the database system searches for JDBC and SQLJ packages.
The setDB2CurrentPackagePath method applies only to connections to DB2 database systems.
public void setDB2CurrentPackageSet(String packageSet)
throws java.sql.SQLException
Specifies the collection ID for the connection. When you set this value, you also set the collection ID of the IBM Data Server Driver for JDBC and SQLJ instance that is used for the connection.
The setDB2CurrentPackageSet method applies only to connections to DB2 database systems.
public void setDB2ProgressiveStreaming(int newSetting)
throws java.sql.SQLException
Sets the progressive streaming setting for all ResultSet objects that are created on the connection.
public void setGlobalSessionVariable(String global-variable-name,
String global-variable-value)
throws java.sql.SQLException
Sets the value of a global variable. This method applies only to connections to DB2 for z/OS Version 11 or later data servers.
public void setJccLogWriter(PrintWriter logWriter)
throws java.sql.SQLException
public void setJccLogWriter(PrintWriter logWriter, int traceLevel)
throws java.sql.SQLException
Enables or disables the IBM Data Server Driver for JDBC and SQLJ trace, or changes the trace destination during an active connection.
public void setSavePointUniqueOption(boolean flag)
throws java.sql.SQLException
Specifies whether an application
can reuse a savepoint name within a unit of recovery. Possible values
are:When false is specified, if the Connection.setSavepoint(savepoint-name) method is executed, and a savepoint with the name savepoint-name already exists within the unit of recovery, the database manager destroys the existing savepoint, and creates a new savepoint with the name savepoint-name.
Reuse of a savepoint is not the same as executing Connection.releaseSavepoint(savepoint-name). Connection.releaseSavepoint(savepoint-name) releases savepoint-name, and any savepoints that were subsequently set.
public void updateDB2XmlSchema(String[] targetSqlIdSchema,
String[] targetSqlIdName,
String[] sourceSqlIdSchema,
String[] sourceSqlIdName,
String[] xmlSchemaLocations,
boolean dropSourceSchema)
throws SQLException
Updates the contents of an XML schema with the contents of another XML schema in the XML schema repository, and optionally drops the source schema. The schema documents in the target XML schema are replaced with the schema documents from the source XML schema. Before updateDB2XmlSchema can be called, registration of the source and target XML schemas must be completed.
The SQL ALTERIN privilege is required for updating the target XML schema. The SQL DROPIN privilege is required for dropping the source XML schema.
This method does not apply to connections to IBM Informix data sources.