Db2Preparedstatement Interface; Db2Resultsetmetadata Interface - IBM DB2 Manual

Table of Contents

Advertisement

DB2PreparedStatement interface

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

DB2ResultSetMetaData interface

|
|
|
Retrieves the total time in milliseconds for requests that were blocked by the
pool. This time can be much larger than the elapsed execution time of the
application if the application uses multiple threads.
The com.ibm.db2.jcc.DB2PreparedStatement interface extends the
com.ibm.db2.jcc.DB2Statement and java.sql.PreparedStatement interfaces.
DB2PreparedStatement methods
The following methods are defined only for the IBM Data Server Driver for JDBC
and SQLJ.
executeDB2QueryBatch
Format:
public void executeDB2QueryBatch()
throws java.sql.SQLException
Executes a statement batch that contains queries with parameters.
This method is not supported for connections to IBM Informix Dynamic Server
data sources.
getDBGeneratedKeys
Format:
public java.sql.ResultSet[] getDBGeneratedKeys()
throws java.sql.SQLException
Retrieves automatically generated keys that were created when INSERT
statements were executed in a batch. Each ResultSet object that is returned
contains the automatically generated keys for a single statement in the batch.
getDBGeneratedKeys returns an array of length 0 under the following
conditions:
v getDBGeneratedKeys is called out of sequence. For example, if
getDBGeneratedKeys is called before executeBatch, an array of length 0 is
returned.
v The PreparedStatement that is executed in a batch was not created using one
of the following methods:
Connection.prepareStatement(String sql, int[] autoGeneratedKeys)
Connection.prepareStatement(String sql, String[] autoGeneratedColumnNames)
Connection.prepareStatement(String sql, Statement.RETURN_GENERATED_KEYS)
If getDBGeneratedKeys is called against a PreparedStatement that was created
using one of the previously listed methods, and the PreparedStatement is not
in a batch, a single ResultSet is returned.
Related tasks
"Making batch queries in JDBC applications" on page 34
Related reference
"DB2Statement interface" on page 354
The com.ibm.db2.jcc.DB2ResultSetMetaData interface provides methods that
provide information about a ResultSet object.
Chapter 7. JDBC and SQLJ reference information
351

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents