DB2 10.5 for Linux, UNIX, and Windows

DB2ResultSetMetaData interface

The com.ibm.db2.jcc.DB2ResultSetMetaData interface provides methods that provide information about a ResultSet object.

Before a com.ibm.db2.jcc.DB2ResultSetMetaData method can be used, a java.sql.ResultSetMetaData object that is returned from a java.sql.ResultSet.getMetaData call needs to be cast to com.ibm.db2.jcc.DB2ResultSetMetaData.

DB2ResultSetMetaData methods:

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

getDB2OptimisticLockingColumns
Format:
public int getDB2OptimisticLockingColumns()
  throws java.sql.SQLException
Returns a value that indicates whether optimistic locking columns are available. Possible values are:
0
Optimistic locking columns are not available.
1
Optimistic locking columns are available, but the change token might not have the granularity to prevent false negatives.
2
Optimistic locking columns are available, and the change token has the granularity to prevent false negatives.
getDBTemporalColumnType
Format:
public int getDBTemporalColumnType (int column) 
  throws java.sql.SQLException
Returns:
-1
If column is not a ROW BEGIN, ROW END or TRANSACTION START ID column.
1
If column is a ROW BEGIN column.
2
If column is a ROW END column.
3
If column is a TRANSACTION START ID column.
Parameter descriptions:
column
The ordinal position of a column in the ResultSet.
getMaxStringUnitBits
Format:
public int getMaxStringUnitBits (int column)
  throws java.sql.SQLException
Returns the maximum number of bits in a string unit for single-byte and double-byte character data types. The value that is returned is:
8
For a character column that is defined with OCTETS.
16
For a character column that is defined with CODEUNITS16.
32
For a character column that is defined with CODEUNITS32.
Parameter descriptions:
column
The ordinal position of a column in the ResultSet.

This method applies only to connections to DB2® for Linux, UNIX, and Windows Version 10.5 or later data servers.

isDB2ColumnNameDerived
Format:
public boolean isDB2ColumnNameDerived (int column) 
  throws java.sql.SQLException

Returns true if the name of a ResultSet column is in the SQL SELECT list that generated the ResultSet.

For example, suppose that a ResultSet is generated from the SQL statement SELECT EMPNAME, SUM(SALARY) FROM EMP. Column name EMPNAME is derived from the SQL SELECT list, but the name of the column in the ResultSet that corresponds to SUM(SALARY) is not derived from the SELECT list.

Parameter descriptions:
column
The ordinal position of a column in the ResultSet.