DB2Statement interface

The com.ibm.db2.jcc.DB2Statement interface extends the java.sql.Statement interface.

DB2Statement implements the java.sql.Wrapper interface.

DB2Statement methods

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

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

Returns the number of rows that are affected by successful execution of an SQL statement. If the SQL statement is INSERT, UPDATE, or DELETE, getAffectedRowCount returns the same value that is returned by java.sql.Statement.getUpdateCount.

The value that is returned by getAffectedRowCount is the same information that is returned by the data server in the SQLCA after successful execution of an SQL statement.

getDB2ClientProgramId
Format:
public String getDB2ClientProgramId()
  throws java.sql.SQLException

Returns the user-defined client program identifier for the connection, which is stored on the data source.

getDB2ClientProgramId does not apply to Db2 on Linux®, UNIX, and Windows systems data servers.

setDB2ClientProgramId
Format:
public abstract void setDB2ClientProgramId(String program-ID) 
  throws java.sql.SQLException

Sets a user-defined program identifier for the connection on a data server. That program identifier is an 80-byte string that is used to identify the caller.

setDB2ClientProgramId does not apply to Db2 on Linux, UNIX, and Windows systems 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.

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

Retrieves an automatically generated key from a BIGSERIAL column after the automatically generated key was inserted by a previously executed INSERT statement.

The following conditions must be true for getIDSBigSerial to execute successfully:
  • The INSERT statement is the last SQL statement that is executed before this method is called.
  • The table into which the row is inserted contains a BIGSERIAL column.
  • The form of the JDBC Connection.prepareStatement method or Statement.executeUpdate method that prepares or executes the INSERT statement does not have parameters that request automatically generated keys.

This method applies only to connections to IBM Informix® databases.

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

Retrieves an automatically generated key from a SERIAL column after the automatically generated key was inserted by a previously executed INSERT statement.

The following conditions must be true for getIDSSerial to execute successfully:
  • The INSERT statement is the last SQL statement that is executed before this method is called.
  • The table into which the row is inserted contains a SERIAL column.
  • The form of the JDBC Connection.prepareStatement method or Statement.executeUpdate method that prepares or executes the INSERT statement does not have parameters that request automatically generated keys.

This method applies only to connections to IBM Informix databases.

getIDSSerial8
Format:
public long getIDSSerial8() 
  throws java.sql.SQLException

Retrieves an automatically generated key from a SERIAL8 column after the automatically generated key was inserted by a previously executed INSERT statement.

The following conditions must be true for getIDSSerial8 to execute successfully:
  • The INSERT statement is the last SQL statement that is executed before this method is called.
  • The table into which the row is inserted contains a SERIAL8 column.
  • The form of the JDBC Connection.prepareStatement method or Statement.executeUpdate method that prepares or executes the INSERT statement does not have parameters that request automatically generated keys.

This method applies only to connections to IBM Informix data sources.

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

After an SQL statement executes on an IBM Informix data source, if the statement has a syntax error, getIDSSQLStatementOffSet returns the offset into the statement text of the syntax error.

getIDSSQLStatementOffSet returns:
  • 0, if the statement does not have a syntax error.
  • -1, if the data source is not IBM Informix.

This method applies only to connections to IBM Informix data sources.

setMAXBLKEXT
Formats:
public void setMAXBLKEXT(int maxblkext) 
  throws SQLException

Specifies the maximum number of extra blocks that the DRDA client can receive from the data server without further prompting.

Parameters:
maxblkext
The number of extra blocks to be returned. Possible values are:
-1
The data server determines the maximum number of extra blocks that the client can receive. -1 is the default.
0
The client receives no extra blocks.
n
The maximum number of extra blocks that the client can receive. n is an integer that is greater than or equal to 1 and less than or equal to 100.

The MAXBLKEXT value that is set through this method overrides the value of the MAXBLKEXT Connection or DataSource property.

This property is applicable only to IBM Data Server Driver for JDBC and SQLJ type 4 connectivity to Db2 for z/OS or Db2 on Linux, UNIX, and Windows systems.