DB2 10.5 for Linux, UNIX, and Windows

DB2Connection interface

The com.ibm.db2.jcc.DB2Connection interface extends the java.sql.Connection interface.

DB2Connection implements the java.sql.Wrapper interface.

DB2Connection methods

The following methods are defined only for the IBM® Data Server Driver for JDBC and SQLJ.

alternateWasUsedOnConnect
Format:
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.

changeDB2Password
Format:
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.

Parameter descriptions:
oldPassword
The original password for the Connection.
newPassword
The new password for the Connection.
createArrayOf
Format:
Array createArrayOf(String typeName,
  Object[] elements)
  throws SQLException;

Creates a java.sql.Array object.

Parameter descriptions:
typeName
The SQL data type of the elements of the array map to. typeName can be a built-in data type or a distinct type.
elements
The elements that populate the Array object.
createStruct
Format:
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.

Parameter descriptions:
typeName
The SQL data type of the SQL structured type that the Struct object maps to. typeName is the name of a user-defined type that has been defined on the data server.
attributes
The attributes that populate the returned Struct object.
deregisterDB2XmlObject
Formats:
public void deregisterDB2XmlObject(String sqlIdSchema,
  String sqlIdName)
  throws SQLException

Removes a previously registered XML schema from the data source.

Parameter descriptions:
sqlIdSchema
The SQL schema name for the XML schema. sqlIdSchema is a String value with a maximum length of 128 bytes. The value of sqlIdSchema must conform to the naming rules for any SQL schema name. The name cannot begin with the string 'SYS'. If the value of sqlIdSchema is null, the database system uses the value in the CURRENT SCHEMA special register.
sqlIdName
The SQL name for the XML schema. sqlIdName is a String value with a maximum length of 128 bytes. The value of sqlIdName must conform to the rules for an SQL identifier. If the value of sqlIdSchema is null, the value of sqlIdName can be null, In that case, the database system generates the value for sqlIdName.
getDB2ClientAccountingInformation
Format:
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.

getDB2ClientApplicationInformation
Format:
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.

getDB2ClientCorrelationToken
Format:
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.

getDB2ClientProgramId
Format:
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.

getDB2ClientUser
Format:
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.

getDB2ClientWorkstation
Format:
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.

getDB2Correlator
Format:
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.

getDB2CurrentPackagePath
Format:
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.

getDB2CurrentPackageSet
Format:
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.

getDB2ProgressiveStreaming
Format:
public int getDB2ProgressiveStreaming()
  throws java.sql.SQLException

Returns the current progressive streaming setting for the connection.

The returned value depends on whether the data source supports progressive streaming, how the progressiveStreaming property is set, and whether DB2Connection.setProgressiveStreaming was called:
  • If the data source does not support progressive streaming, 2 (NO) is always returned, regardless of the progressiveStreaming property setting.
  • If the data source supports progressive streaming, and DB2Connection.setProgressiveStreaming was called, the returned value is the value that DB2Connection.setProgressiveStreaming set.
  • If the data source supports progressive streaming, and DB2Connection.setProgressiveStreaming was not called, the returned value is 2 (NO) if progressiveStreaming was set to DB2BaseDataSource.NO. If progressiveStreaming was set to DB2BaseDataSource.YES or was not set, the returned value is 1 (YES).
getDB2SecurityMechanism
Format:
public int getDB2SecurityMechanism()
  throws java.sql.SQLException
Returns the security mechanism that is in effect for the connection:
3
Clear text password security
4
User ID-only security
7
Encrypted password security
9
Encrypted user ID and password security
11
Kerberos security
12
Encrypted user ID and data security
13
Encrypted user ID, password, and data security
15
Plugin security
16
Encrypted user ID-only security
getDB2SystemMonitor
Format:
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.

getDBConcurrentAccessResolution
Format:
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.

getDBProgressiveStreaming
Format:
public int getDB2ProgressiveStreaming()
  throws java.sql.SQLException

Returns the current progressive streaming setting for the connection.

The returned value depends on whether the data source supports progressive streaming, how the progressiveStreaming property is set, and whether DB2Connection.setProgressiveStreaming was called:
  • If the data source does not support progressive streaming, 2 (NO) is always returned, regardless of the progressiveStreaming property setting.
  • If the data source supports progressive streaming, and DB2Connection.setProgressiveStreaming was called, the returned value is the value that DB2Connection.setProgressiveStreaming set.
  • If the data source supports progressive streaming, and DB2Connection.setProgressiveStreaming was not called, the returned value is 2 (NO) if progressiveStreaming was set to DB2BaseDataSource.NO. If progressiveStreaming was set to DB2BaseDataSource.YES or was not set, the returned value is 1 (YES).
getDBStatementConcentrator
Format:
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.

getJccLogWriter
Format:
public PrintWriter getJccLogWriter()
  throws java.sql.SQLException

Returns the current trace destination for the IBM Data Server Driver for JDBC and SQLJ trace.

getJccSpecialRegisterProperties
Format:
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.

getSavePointUniqueOption
Format:
public boolean getSavePointUniqueOption()
  throws java.sql.SQLException
Returns true if setSavePointUniqueOption was most recently called with a value of true. Returns false otherwise.
installDB2JavaStoredProcedure
Format:
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.

Parameter descriptions:
jarFile
The contents of the JAR file that is to be defined to the server.
jarFileLength
The length of the JAR file that is to be defined to the server.
jarId
The name of the JAR in the database, in the form schema.JAR-id or JAR-id. This is the name that you use when you refer to the JAR in SQL statements. If you omit schema, the database system uses the SQL authorization ID that is in the CURRENT SCHEMA special register. The owner of the JAR is the authorization ID in the CURRENT SQLID special register.

This method does not apply to connections to IBM Informix data sources.

isDB2Alive
Format:
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.

isDBValid
Format:
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.

Parameter descriptions:
throwException
Specifies whether isDBValid throws an SQLException if the connection is not valid. Possible values are:
true
isDBValid throws an SQLException if the connection is not valid.
false
isDBValid throws an SQLException only if the value of timeout is not valid.
timeout
The time in seconds to wait for completion of a database operation that the driver submits. The driver submits that database operation to the data source to validate the connection. If the timeout period expires before the database operation completes, isDBValid returns false. A value of 0 indicates that there is no timeout period for the database operation.

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.

prepareDB2OptimisticLockingQuery
Format:
public java.sql.PreparedStatement 
  DB2Connection.prepareDB2OptimisticLockingQuery(String sql, 
  int returnOptimisticLockingColumns)
  throws SQLException

Creates a PreparedStatement object that can request optimistic locking information.

Parameter descriptions:
sql
The SQL statement that is to be prepared.
returnOptimisticLockingColumns
Specifies whether optimistic locking columns are returned. Possible values are:
Table 1. Values for the returnOptimisticLockingColumns parameter
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.
reconfigureDB2Connection
Format:
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.

Trusted connections are supported for:
  • IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to:
    • DB2 for Linux, UNIX, and Windows Version 9.5 or later
    • DB2 for z/OS Version 9.1 or later
    • IBM Informix Version 11.70 or later
  • IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS Version 9.1 or later
Parameter descriptions:
properties
New properties for the connection. These properties override any properties that are already defined on the DB2Connection instance.
registerDB2XmlSchema
Formats:
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.

Parameter descriptions:
sqlIdSchema
The SQL schema name for the XML schema. Only the first element of the sqlIdSchema array is used. sqlIdSchema is a String value with a maximum length of 128 bytes. The value of sqlIdSchema must conform to the naming rules for any SQL schema name. The name cannot begin with the string 'SYS'. If the value of sqlIdSchema is null, the database system uses the value in the CURRENT SCHEMA special register.
sqlIdName
The SQL name for the XML schema. Only the first element of the sqlIdName array is used. sqlIdName is a String value with a maximum length of 128 bytes. The value of sqlIdName must conform to the rules for an SQL identifier. If the value of sqlIdSchema is null, the value of sqlIdName can be null, In that case, the database system generates the value for sqlIdName.
xmlSchemaLocations
XML schema locations for the primary XML schema documents of the schemas that are being registered. XML schema location values are normally in URI format. Each xmlSchemaLocations value is a String value with a maximum length of 1000 bytes. The value is used only to match the information that is specified in the XML schema document that references this document. The database system does no validation of the format, and no attempt is made to resolve the URI.
xmlSchemaDocuments
The content of the primary XML schema documents. Each xmlSchemaDocuments value is a String or InputStream value with a maximum length of 30 MB. The values must not be null.
xmlSchemaDocumentsLengths
The lengths of the XML schema documents in the xmlSchemaDocuments parameter, if the first form of registerDB2XmlSchema is used. Each xmlSchemaDocumentsLengths value is an int value.
xmlSchemaDocumentsProperties
Contains properties of the primary XML schema documents, such as properties that are used by an external XML schema versioning system. The database system does no validation of the contents of these values. They are stored in the XSR table for retrieval and used in other tools and XML schema repository implementations. Each xmlSchemaDocumentsProperties value is a String or InputStream value with a maximum length of 5 MB. A value is null if there are no properties to be passed.
xmlSchemaDocumentsPropertiesLengths
The lengths of the XML schema properties in the xmlSchemaDocumentsProperties parameter, if the first form of registerDB2XmlSchema is used. Each xmlSchemaDocumentsPropertiesLengths value is an int value.
xmlSchemaProperties
Contains properties of the entire XML schema, such as properties that are used by an external XML schema versioning system. The database system does no validation of the contents of this value. They are stored in the XSR table for retrieval and used in other tools and XML schema repository implementations. The xmlSchemaProperties value is a String or InputStream value with a maximum length of 5 MB. The value is null if there are no properties to be passed.
xmlSchemaPropertiesLengths
The length of the XML schema property in the xmlSchemaProperties parameter, if the first form of registerDB2XmlSchema is used. The xmlSchemaPropertiesLengths value is an int value.
isUsedForShredding
Indicates whether there are annotations in the schema that are to be used for XML decomposition. isUsedForShredding is a boolean value.

This method does not apply to connections to IBM Informix data sources.

setDBConcurrentAccessResolution
Format:
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.

Parameter descriptions:
concurrentAccessResolution
One of the following integer values:
DB2BaseDataSource.-
CONCURRENTACCESS_USE_CURRENTLY_COMMITTED (1)
The IBM Data Server Driver for JDBC and SQLJ requests that:
  • Read transactions access the currently committed data when the data is being updated or deleted.
  • Read transactions skip rows that are being inserted.
DB2BaseDataSource.CONCURRENTACCESS_WAIT_FOR_OUTCOME (2)
The IBM Data Server Driver for JDBC and SQLJ requests that:
  • Read transactions wait for a commit or rollback operation when they encounter data that is being updated or deleted.
  • Read transactions do not skip rows that are being inserted.
DB2BaseDataSource.CONCURRENTACCESS_NOT_SET (0)
Enables the data server's default behavior for read transactions when lock contention occurs. This is the default value.
setDBProgressiveStreaming
Format:
public void setDB2ProgressiveStreaming(int newSetting)
  throws java.sql.SQLException

Sets the progressive streaming setting for all ResultSet objects that are created on the connection.

Parameter descriptions:
newSetting
The new progressive streaming setting. Possible values are:
DB2BaseDataSource.YES (1)
Enable progressive streaming. If the data source does not support progressive streaming, this setting has no effect.
DB2BaseDataSource.NO (2)
Disable progressive streaming.
setDBStatementConcentrator
Format:
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.
Parameter descriptions:
statementConcentratorUse
One of the following integer values:
DB2BaseDataSource.STATEMENT_CONCENTRATOR_OFF (1)
The IBM Data Server Driver for JDBC and SQLJ does not use the data source's statement concentrator functionality.
DB2BaseDataSource.STATEMENT_CONCENTRATOR_WITH_LITERALS (2)
The IBM Data Server Driver for JDBC and SQLJ uses the data source's statement concentrator functionality.
DB2BaseDataSource.STATEMENT_CONCENTRATOR_NOT_SET (0)
Enables the data server's default behavior for statement concentrator functionality. This is the default value.

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.

removeDB2JavaStoredProcedure
Format:
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.

Parameter descriptions:
jarId
The name of the JAR in the database, in the form schema.JAR-id or JAR-id. This is the name that you use when you refer to the JAR in SQL statements. If you omit schema, the database system uses the SQL authorization ID that is in the CURRENT SCHEMA special register.

This method does not apply to connections to IBM Informix data sources.

replaceDB2JavaStoredProcedure
Format:
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.

Parameter descriptions:
jarFile
The contents of the JAR file that is to be replaced on the server.
jarFileLength
The length of the JAR file that is to be replace on the server.
jarId
The name of the JAR in the database, in the form schema.JAR-id or JAR-id. This is the name that you use when you refer to the JAR in SQL statements. If you omit schema, the database system uses the SQL authorization ID that is in the CURRENT SCHEMA special register. The owner of the JAR is the authorization ID in the CURRENT SQLID special register.

This method does not apply to connections to IBM Informix data sources.

reuseDB2Connection (trusted connection reuse)
Formats:
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
Trusted connections are supported for:
  • IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to:
    • DB2 for Linux, UNIX, and Windows Version 9.5 or later
    • DB2 for z/OS Version 9.1 or later
    • IBM Informix Version 11.70 or later
  • IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS Version 9.1 or later

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.

Parameter descriptions:
cookie
A unique cookie that the JDBC driver generates for the Connection instance. The cookie is known only to the application server and the underlying JDBC driver that established the initial trusted connection. The application server passes the cookie that was created by the driver when the pooled connection instance was created. The JDBC driver checks that the supplied cookie matches the cookie of the underlying trusted physical connection to ensure that the request originated from the application server that established the trusted physical connection. If the cookies match, the connection becomes available for immediate use, with different properties, by the new user .
user
The client ID that the database system uses to establish the database authorization ID. If the user was not authenticated by the application server, the application server needs to pass a client ID that represents an unauthenticated user.
password
The password for user.
gssCredential
If the data source uses Kerberos security, specifies a delegated credential that is passed from another principal.
userNameRegistry
A name that identifies a mapping service that maps a workstation user ID to a z/OS RACF® ID. An example of a mapping service is the Integrated Security Services Enterprise Identity Mapping (EIM). The mapping service is defined by a plugin. Valid values for userNameRegistry are defined by the plugin providers. If userNameRegistry is null, no mapping of user is done.
userSecToken
The client's security tokens. This value is traced as part of DB2 for z/OS accounting data. The content of userSecToken is described by the application server and is referred to by the database system as an application server security token.
originalUser
The original user ID that was used by the application server.
properties
Properties for the reused connection.
reuseDB2Connection (untrusted reuse with reauthentication)
Formats:
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.

Parameter description:
user
The authorization ID that is used to establish the connection.
password
The password for the authorization ID that is used to establish the connection.
gssCredential
If the data source uses Kerberos security, specifies a delegated credential that is passed from another principal.
properties
Properties for the reused connection. These properties override any properties that are already defined on the DB2Connection instance.
reuseDB2Connection (untrusted or trusted reuse without reauthentication)
Formats:
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.

Trusted connections are supported for:
  • IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to:
    • DB2 for Linux, UNIX, and Windows Version 9.5 or later
    • DB2 for z/OS Version 9.1 or later
    • IBM Informix Version 11.70 or later
  • IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on DB2 for z/OS Version 9.1 or later

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.

Parameter description:
properties
Properties for the reused connection. These properties override any properties that are already defined on the DB2Connection instance.
setDB2ClientAccountingInformation
Format:
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.

Parameter description:
info
User-specified accounting information.

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.

setDB2ClientApplicationInformation
Format:
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.

Parameter description:
info
User-specified application information.

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.

setDB2ClientCorrelationToken
Format:
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.

Parameter description:
client-correlation-token
A unique value that can be used to correlate business processes across an enterprise. The maximum length is 255 bytes.
setDB2ClientDebugInfo
Formats:
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.

Setting the CLIENT DEBUGINFO attribute to a string of length greater than zero requires one of the following privileges:
  • The DEBUGSESSION privilege
  • SYSADM authority
Parameter description:
debugInfo
A string of up to 254 bytes, in the following form:
Mip:port,Iip,Ppid,Ttid,Cid,Llvl
The parts of the string are:
Mip:port
Session manager IP address and port number
Iip
Client IP address
Ppid
Client process ID
Ttid
Client thread ID (optional)
Cid
Data connection generated ID
Llvl
Debug library diagnostic trace level
For example:
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.
mgrInfo
A string of the following form, which specifies the IP address and port number for the Unified Debugger session manager.
Mip:port
For example:
M9.72.133.89:8355
See the description of SET CLIENT DEBUGINFO for a detailed description of this string.
trcInfo
A string of the following form, which specifies the debug library diagnostics trace level.
Llvl
For example:
L0
See the description of SET CLIENT DEBUGINFO for a detailed description of this string.
setDB2ClientProgramId
Format:
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.

setDB2ClientUser
Format:
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.

Parameter description:
user
The user ID for the current client. The maximum length depends on the server.

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.

setDB2ClientWorkstation
Format:
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.

Parameter description:
name
The workstation name for the current client.

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.

setDB2CurrentPackagePath
Format:
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.

Parameter description:
packagePath
A comma-separated list of collection IDs.
setDB2CurrentPackageSet
Format:
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.

Parameter description:
packageSet
The collection ID for the connection. The maximum length for the packageSet value is 18 bytes. You can invoke this method as an alternative to executing the SQL SET CURRENT PACKAGESET statement in your program.
setDB2ProgressiveStreaming
Format:
public void setDB2ProgressiveStreaming(int newSetting)
  throws java.sql.SQLException

Sets the progressive streaming setting for all ResultSet objects that are created on the connection.

Parameter descriptions:
newSetting
The new progressive streaming setting. Possible values are:
DB2BaseDataSource.YES (1)
Enable progressive streaming. If the data source does not support progressive streaming, this setting has no effect.
DB2BaseDataSource.NO (2)
Disable progressive streaming.
setGlobalSessionVariable
Format:
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.

Parameter descriptions:
global-variable-name
The name of a global variable that is defined on the data server.
global-variable-value
The value that is assigned to the global variable.
setJccLogWriter
Formats:
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.

Parameter descriptions:
logWriter
An object of type java.io.PrintWriter to which the IBM Data Server Driver for JDBC and SQLJ writes trace output. To turn off the trace, set the value of logWriter to null.
traceLevel
Specifies the types of traces to collect. See the description of the traceLevel property in "Properties for the IBM Data Server Driver for JDBC and SQLJ" for valid values.
setSavePointUniqueOption
Format:
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:
true
A Connection.setSavepoint(savepoint-name) method cannot specify the same value for savepoint-name more than once within the same unit of recovery.
false
A Connection.setSavepoint(savepoint-name) method can specify the same value for savepoint-name more than once within the same unit of recovery.

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.

updateDB2XmlSchema
Format:
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.

Parameter descriptions:
targetSqlIdSchema
The SQL schema name for a registered XML schema that is to be updated. targetSqlIdSchema is a String value with a maximum length of 128 bytes.
targetSqlIdName
The name of the registered XML schema that is to be updated. targetSqlIdName is a String value with a maximum length of 128 bytes.
sourceSqlIdSchema
The SQL schema name for a registered XML schema that is used to update the target XML schema. sourceSqlIdSchema is a String value with a maximum length of 128 bytes.
sourceSqlIdName
The name of the registered XML schema that is used to update the target XML schema. sourceSqlIdName is a String value with a maximum length of 128 bytes.
dropSourceSchema
Indicates whether the source XML schema is to be dropped after the target XML schema is updated. dropSourceSchema is a boolean value. false is the default.

This method does not apply to connections to IBM Informix data sources.