All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.AS400JDBCResultSet

java.lang.Object
   |
   +----com.ibm.as400.access.AS400JDBCResultSet

public class AS400JDBCResultSet
extends Object
implements ResultSet

The AS400JDBCResultSet class provides access to a table of data generated by a database query. The table rows are retrieved in sequence. Within a row, column values can be accessed in any order.

A result set maintains a cursor pointing to its current row of data. Initially, the cursor is positioned before the first row. next() moves the cursor to the next row.

The get methods retrieve column values for the current row. Values can be retrieved using either the index of the column or by using the name of the column. In general, using the column index is more efficient. Column indexes are numbered starting with 1. Column names used as input to get methods are not case sensitive. If several columns have the same name, then the first matching column will be used.

In each get method, the driver attempts to convert the underlying data to the specified Java type and returns a suitable Java value. If such a conversion is not appropriate, an SQLException is thrown.

A result set is automatically closed by the statement that generated it when the statement is closed, executed again, or used to retrieve the next result set from a sequence of multiple result sets.

See Also:
AS400JDBCResultSetMetaData

Method Index

 o clearWarnings()
Clears all warnings that have been reported for the result set.
 o close()
Releases the result set's resources immediately instead of waiting for them to be automatically released.
 o finalize()
Closes the result set if not explicitly closed by the caller.
 o findColumn(String)
Returns the column index for the specified column name.
 o getAsciiStream(int)
Returns the value of a column as a stream of ASCII characters.
 o getAsciiStream(String)
Returns the value of a column as a stream of ASCII characters.
 o getBigDecimal(int, int)
Returns the value of a column as a BigDecimal object.
 o getBigDecimal(String, int)
Returns the value of a column as a BigDecimal object.
 o getBinaryStream(int)
Returns the value of a column as a stream of uninterpreted bytes.
 o getBinaryStream(String)
Returns the value of a column as a stream of uninterpreted bytes.
 o getBoolean(int)
Returns the value of a column as a Java boolean value.
 o getBoolean(String)
Returns the value of a column as a Java boolean value.
 o getByte(int)
Returns the value of a column as a Java byte value.
 o getByte(String)
Returns the value of a column as a Java byte value.
 o getBytes(int)
Returns the value of a column as a Java byte array.
 o getBytes(String)
Returns the value of a column as a Java byte array.
 o getCursorName()
Returns the name of the SQL cursor in use by the result set.
 o getDate(int)
Returns the value of a column as a java.sql.Date object.
 o getDate(String)
Returns the value of a column as a java.sql.Date object.
 o getDouble(int)
Returns the value of a column as a Java double value.
 o getDouble(String)
Returns the value of a column as a Java double value.
 o getFloat(int)
Returns the value of a column as a Java float value.
 o getFloat(String)
Returns the value of a column as a Java float value.
 o getInt(int)
Returns the value of a column as a Java int value.
 o getInt(String)
Returns the value of a column as a Java int value.
 o getLong(int)
Returns the value of a column as a Java long value.
 o getLong(String)
Returns the value of a column as a Java long value.
 o getMetaData()
Returns the AS400JDBCResultSetMetaData object that describes the result set's columns.
 o getObject(int)
Returns the value of a column as a Java Object.
 o getObject(String)
Returns the value of a column as a Java Object value.
 o getShort(int)
Returns the value of a column as a Java short value.
 o getShort(String)
Returns the value of a column as a Java short value.
 o getString(int)
Returns the value of a column as a String object.
 o getString(String)
Returns the value of a column as a String object.
 o getTime(int)
Returns the value of a column as a java.sql.Time object.
 o getTime(String)
Returns the value of a column as a java.sql.Time object.
 o getTimestamp(int)
Returns the value of a column as a java.sql.Timestamp object.
 o getTimestamp(String)
Returns the value of a column as a java.sql.Timestamp object.
 o getUnicodeStream(int)
Returns the value of a column as a stream of Unicode characters.
 o getUnicodeStream(String)
Returns the value of a column as a stream of Unicode characters.
 o getWarnings()
Returns the first warning reported for the result set.
 o next()
Positions the cursor to the next row of the result set.
 o toString()
Returns the name of the SQL cursor in use by the result set.
 o wasNull()
Indicates if the last column read has the value of SQL NULL.

Methods

 o clearWarnings
 public void clearWarnings() throws SQLException
Clears all warnings that have been reported for the result set. After this call, getWarnings() returns null until a new warning is reported for the result set.

Throws: SQLException
If an error occurs.
 o close
 public void close() throws SQLException
Releases the result set's resources immediately instead of waiting for them to be automatically released.

Throws: SQLException
If an error occurs.
 o finalize
 protected void finalize() throws Throwable
Closes the result set if not explicitly closed by the caller.

Throws: Throwable
If an error occurs.
Overrides:
finalize in class Object
 o findColumn
 public int findColumn(String columnName) throws SQLException
Returns the column index for the specified column name.

Parameters:
columnName - The column name.
Returns:
The column index (1-based).
Throws: SQLException
If the result set is not open or the column name is not found.
 o getAsciiStream
 public InputStream getAsciiStream(int index) throws SQLException
Returns the value of a column as a stream of ASCII characters. This can be used to get values from columns with SQL types CHAR, VARCHAR, BINARY, and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getAsciiStream
 public InputStream getAsciiStream(String columnName) throws SQLException
Returns the value of a column as a stream of ASCII characters. This can be used to get values from columns with SQL types CHAR, VARCHAR, BINARY, and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getBigDecimal
 public BigDecimal getBigDecimal(int index,
                                 int scale) throws SQLException
Returns the value of a column as a BigDecimal object. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
scale - The number of digits after the decimal.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, the scale is not valid, or the requested conversion is not valid.
 o getBigDecimal
 public BigDecimal getBigDecimal(String columnName,
                                 int scale) throws SQLException
Returns the value of a column as a BigDecimal object. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
scale - The number of digits after the decimal.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, the scale is not valid, or the requested conversion is not valid.
 o getBinaryStream
 public InputStream getBinaryStream(int index) throws SQLException
Returns the value of a column as a stream of uninterpreted bytes. This can be used to get values from columns with SQL types BINARY and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getBinaryStream
 public InputStream getBinaryStream(String columnName) throws SQLException
Returns the value of a column as a stream of uninterpreted bytes. This can be used to get values from columns with SQL types BINARY and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getBoolean
 public boolean getBoolean(int index) throws SQLException
Returns the value of a column as a Java boolean value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or false if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getBoolean
 public boolean getBoolean(String columnName) throws SQLException
Returns the value of a column as a Java boolean value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or false if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getByte
 public byte getByte(int index) throws SQLException
Returns the value of a column as a Java byte value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getByte
 public byte getByte(String columnName) throws SQLException
Returns the value of a column as a Java byte value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getBytes
 public byte[] getBytes(int index) throws SQLException
Returns the value of a column as a Java byte array. This can be used to get values from columns with SQL types BINARY and VARBINARY.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getBytes
 public byte[] getBytes(String columnName) throws SQLException
Returns the value of a column as a Java byte array. This can be used to get values from columns with SQL types BINARY and VARBINARY.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getCursorName
 public String getCursorName() throws SQLException
Returns the name of the SQL cursor in use by the result set. In SQL, results are retrieved through a named cursor. The current row of a result can be updated or deleted using a positioned UPDATE or DELETE statement that references a cursor name.

Returns:
The cursor name.
Throws: SQLException
If the result is not open.
See Also:
setCursorName
 o getDate
 public Date getDate(int index) throws SQLException
Returns the value of a column as a java.sql.Date object. This can be used to get values from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getDate
 public Date getDate(String columnName) throws SQLException
Returns the value of a column as a java.sql.Date object. This can be used to get values from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getDouble
 public double getDouble(int index) throws SQLException
Returns the value of a column as a Java double value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getDouble
 public double getDouble(String columnName) throws SQLException
Returns the value of a column as a Java double value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getFloat
 public float getFloat(int index) throws SQLException
Returns the value of a column as a Java float value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getFloat
 public float getFloat(String columnName) throws SQLException
Returns the value of a column as a Java float value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getInt
 public int getInt(int index) throws SQLException
Returns the value of a column as a Java int value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getInt
 public int getInt(String columnName) throws SQLException
Returns the value of a column as a Java int value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getLong
 public long getLong(int index) throws SQLException
Returns the value of a column as a Java long value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getLong
 public long getLong(String columnName) throws SQLException
Returns the value of a column as a Java long value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getMetaData
 public ResultSetMetaData getMetaData() throws SQLException
Returns the AS400JDBCResultSetMetaData object that describes the result set's columns.

Returns:
The meta data object.
Throws: SQLException
If the result set is not open.
 o getObject
 public Object getObject(int index) throws SQLException
Returns the value of a column as a Java Object. This can be used to get values from columns with all SQL types.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getObject
 public Object getObject(String columnName) throws SQLException
Returns the value of a column as a Java Object value. This can be used to get values from columns with all SQL types.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getShort
 public short getShort(int index) throws SQLException
Returns the value of a column as a Java short value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
index - The column index (1-based).
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getShort
 public short getShort(String columnName) throws SQLException
Returns the value of a column as a Java short value. This can be used to get values from columns with SQL types SMALLINT, INTEGER, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, CHAR, and VARCHAR.

Parameters:
columnName - The column name.
Returns:
The value or 0 if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getString
 public String getString(int index) throws SQLException
Returns the value of a column as a String object. This can be used to get values from columns with any SQL type.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getString
 public String getString(String columnName) throws SQLException
Returns the value of a column as a String object. This can be used to get values from columns with any SQL type.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getTime
 public Time getTime(int index) throws SQLException
Returns the value of a column as a java.sql.Time object. This can be used to get values from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getTime
 public Time getTime(String columnName) throws SQLException
Returns the value of a column as a java.sql.Time object. This can be used to get values from columns with SQL types CHAR, VARCHAR, TIME, and TIMESTAMP.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getTimestamp
 public Timestamp getTimestamp(int index) throws SQLException
Returns the value of a column as a java.sql.Timestamp object. This can be used to get values from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getTimestamp
 public Timestamp getTimestamp(String columnName) throws SQLException
Returns the value of a column as a java.sql.Timestamp object. This can be used to get values from columns with SQL types CHAR, VARCHAR, DATE, and TIMESTAMP.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getUnicodeStream
 public InputStream getUnicodeStream(int index) throws SQLException
Returns the value of a column as a stream of Unicode characters. This can be used to get values from columns with SQL types CHAR, VARCHAR, BINARY, and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
index - The column index (1-based).
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the index is not valid, or the requested conversion is not valid.
 o getUnicodeStream
 public InputStream getUnicodeStream(String columnName) throws SQLException
Returns the value of a column as a stream of Unicode characters. This can be used to get values from columns with SQL types CHAR, VARCHAR, BINARY, and VARBINARY. All of the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Parameters:
columnName - The column name.
Returns:
The value or null if the value is SQL NULL.
Throws: SQLException
If the result set is not open, the column name is not found, or the requested conversion is not valid.
 o getWarnings
 public SQLWarning getWarnings() throws SQLException
Returns the first warning reported for the result set. Subsequent warnings may be chained to this warning.

Returns:
The first warning or null if no warnings have been reported.
Throws: SQLException
If an error occurs.
See Also:
clearWarnings
 o next
 public boolean next() throws SQLException
Positions the cursor to the next row of the result set. The result set's cursor is initially positioned before its first row. The first call to next() makes the first row the current row. Each subsequent call to next() advances the cursor to the next row. If an InputStream from the previous row is open, it is implicitly closed. In addition, all warnings are cleared.

Returns:
true if the new current row is valid, false if there are no more rows.
Throws: SQLException
If an error occurs.
 o toString
 public String toString()
Returns the name of the SQL cursor in use by the result set.

Returns:
The cursor name.
Overrides:
toString in class Object
 o wasNull
 public boolean wasNull() throws SQLException
Indicates if the last column read has the value of SQL NULL.

Returns:
true if the value is SQL NULL; false otherwise.
Throws: SQLException
If the result set is not open.

All Packages  Class Hierarchy  This Package  Previous  Next  Index