Methods of ResultSet Interface in JDBC

Methods of ResultSet Interface in JDBC

The ResultSet interface provides access to a table of data. A ResultSet object is usually generated by executing a Statement.
A ResultSet maintains a cursor pointing to its current row of data. Initially, the cursor is positioned before the first row. The next() method moves the cursor to the next row.
The getXXX methods retrieve column values for the current row. You can retrieve values using either the index number of the column or the name of the column. In general, using the column index is more efficient. Columns are numbered from one. The JDBC driver converts the underlying data to the Java™ type specified in the getter method and returns a suitable Java value.
java.sql package
public interface ResultSet
ResultSet interface fields
Field type Field
static int CONCUR_READ_ONLY
The constant indicating the concurrency mode for a ResultSet object that can NOT be updated.
static int TYPE_FORWARD_ONLY
The constant indicating the type for a ResultSet object whose cursor can move only forward.
static int TYPE_SCROLL_INSENSITIVE
The constant indicating the type for a ResultSet object that is scrollable but generally not sensitive to changes made by others.
static int TYPE_SCROLL_SENSITIVE
The constant indicating the type for a ResultSet object that is scrollable and generally sensitive to changes made by others.
boolean absolute(int row) JDBC 2.0.
Moves the cursor to the given row number in the result set.
void afterLast() JDBC 2.0.
Moves the cursor to the end of the result set, just after the last row.
void beforeFirst() JDBC 2.0.
Moves the cursor to the front of the result set, just before the first row.
void clearWarnings()
Clears all warnings reported on this ResultSet object.
void close()
Releases this ResultSet object’s database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
int findColumn(String columnName)
Maps the given ResultSet column name to its ResultSet column index.
boolean first() JDBC 2.0.
Moves the cursor to the first row in the result set.
BigDecimal getBigDecimal(int columnIndex) JDBC 2.0.
Gets the value of a column in the current row as a java.math.BigDecimal object with full precision. This method is not supported by the DB2 Everyplace JDBC driver for Palm OS.
BigDecimal getBigDecimal(int columnIndex, int scale)
Gets the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal object in the Java programming language. This method is not supported by the DB2 Everyplace JDBC driver for Palm OS.
Deprecated.
BigDecimal getBigDecimal(String columnName) JDBC 2.0.
Gets the value of a column in the current row as a java.math.BigDecimal object with full precision. This method is not supported by the DB2 Everyplace JDBC driver for Palm OS.
BigDecimal getBigDecimal(String columnName, int scale)
Gets the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal object in the Java programming language. This method is not supported by the DB2 Everyplace JDBC driver for Palm OS.
Deprecated.
InputStream getBinaryStream(int columnIndex)
InputStream getBinaryStream(String columnName)
Blob getBlob(int columnIndex) JDBC 2.0.
Gets a BLOB value in the current row of this ResultSet object.
Blob getBlob(String columnName) JDBC 2.0.
Gets a BLOB value in the current row of this ResultSet object.
boolean getBoolean(int columnIndex)
Gets the value of a column in the current row as a Java boolean. The driver first gets the value of the column as a Java short. If the value is equal to 1, true is returned. Otherwise, false is returned.
boolean getBoolean(String columnName)
Gets the value of a column in the current row as a Java boolean. The driver first gets the value of the column as a Java short. If the value is equal to 1, true is returned. Otherwise, false is returned.
byte getByte(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
byte getByte(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
byte[] getBytes(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
byte[] getBytes(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
int getConcurrency() JDBC 2.0. Returns the concurrency mode of the result set.
Date getDate(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
Date getDate(int columnIndex, Calendar cal)
Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
Date getDate(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
double getDouble(int columnIndex)
Gets the value of a column in the current row as a Java double.
double getDouble(String columnName)
Gets the value of a column in the current row as a Java double.
float getFloat(int columnIndex)
getFloat(int columnIndex) Gets the value of a column in the current row as a Java float.
float getFloat(String columnName)
Gets the value of a column in the current row as a Java float.
int getInt(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as an integer in the Java programming language.
int getInt(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as an integer in the Java programming language.
long getLong(int columnIndex)
Gets the value of a column in the current row as a Java long.
long getLong(String columnName)
Gets the value of a column in the current row as a Java long.
ResultSetMetaData getMetaData()
Retrieves the number, types, and properties of this ResultSet object’s columns.
Object getObject(int columnIndex)
Gets the value of a column in the current row as a Java object.
Object getObject(String columnName)
Gets the value of a column in the current row as a Java object.
int getRow() JDBC 2.0.
Retrieves the current row number.
short getShort(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
short getShort(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
Statement getStatement() JDBC 2.0.
Returns the Statement that produced this ResultSet object.
String getString(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
String getString(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
Time getTime(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
Time getTime(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
Timestamp getTimestamp(String columnName)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.
Timestamp; getTimestamp(int columnIndex)
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.
int getType() JDBC 2.0.
Returns the type of this result set.
SQLWarning getWarnings()
The first warning reported by calls on this ResultSet is returned.
boolean isAfterLast() JDBC 2.0.
Indicates whether the cursor is after the last row in the result set.
boolean isBeforeFirst() JDBC 2.0.
Indicates whether the cursor is before the first row in the result set.
boolean isFirst() JDBC 2.0.
Indicates whether the cursor is on the first row of the result set.
boolean isLast() JDBC 2.0.
Indicates whether the cursor is on the last row of the result set. This method is not supported for result sets with type TYPE_FORWARD_ONLY.
Boolean last() JDBC 2.0.
Moves the cursor to the last row in the result set.
boolean next()
Moves the cursor down one row from its current position.
boolean previous() JDBC 2.0.
Moves the cursor to the previous row in the result set.
boolean relative(int rows) JDBC 2.0.
Moves the cursor a relative number of rows, either positive or negative.
boolean wasNull()
Reports whether the last column read had a value of SQL NULL.

Scroll to Top