java.sql.ResultSet |
Known Indirect Subclasses |
An interface for an object which represents a database table entry, returned as the result of the query to the database.
ResultSet
s have a cursor which points to the current data table row.
When the ResultSet
is created, the cursor's location is one position
ahead of the first row. To move the cursor to the first and consecutive rows,
use the next
method. The next
method returns true
as
long as there are more rows in the ResultSet
, otherwise it returns
false
.
The default type of ResultSet
can not be updated and its cursor can
only advance forward through the rows of data. This means that it is only
possible to read through it once. However, other kinds of ResultSet
are implemented: an updatable type and also types where the cursor can
be scrolled forward and backward through the rows of data. How such a
ResultSet
is created is demonstrated in the following example:
Connection con;
Statement aStatement = con.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE );
ResultSet theResultSet =
theStatement.executeQuery("SELECT price, quantity FROM STOCKTABLE");
// theResultSet is both scrollable and updatable
The ResultSet
interface provides a series of methods for retrieving
data from columns in the current row, such as getDate
and getFloat
. The columns are retrieved either by their index number (starting
at 1) or by their name - there are separate methods for both techniques of
column addressing. The column names are case insensitive. If several columns
have the same name, then the getter methods use the first matching column.
This means that if column names are used, it is not possible to guarantee
that the name will retrieve data from the intended column - for certainty it
is better to use column indexes. Ideally the columns should be read
left-to-right and read once only, since not all databases are optimized to
handle other techniques of reading the data.
When reading data via the appropriate getter methods, the JDBC driver maps the SQL data retrieved from the database to the Java type implied by the method invoked by the application. The JDBC specification has a table for the mappings from SQL types to Java types.
There are also methods for writing data into the ResultSet
, such as
updateInt
and updateString
. The update methods can be used
either to modify the data of an existing row or to insert new data rows into
the ResultSet
. Modification of existing data involves moving the
cursor to the row which needs modification and then using the update methods
to modify the data, followed by calling the ResultSet.updateRow
method. For insertion of new rows, the cursor is first moved to a special row
called the Insert Row, data is added using the update methods,
followed by calling the ResultSet.insertRow
method.
A ResultSet
is closed if the statement which generated it closes, the
statement is executed again, or the same statement's next ResultSet
is retrieved (if the statement returned of multiple results).
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CLOSE_CURSORS_AT_COMMIT | A constant used to indicate that a ResultSet object must be
closed when the method Connection.commit is invoked. |
|||||||||
int | CONCUR_READ_ONLY | A constant used to indicate the concurrency mode for a ResultSet
object that cannot be updated. |
|||||||||
int | CONCUR_UPDATABLE | A constant used to indicate the concurrency mode for a ResultSet
object that can be updated. |
|||||||||
int | FETCH_FORWARD | A constant used to indicate processing of the rows of a ResultSet
in the forward direction, first to last. |
|||||||||
int | FETCH_REVERSE | A constant used to indicate processing of the rows of a ResultSet
in the reverse direction, last to first. |
|||||||||
int | FETCH_UNKNOWN | A constant used to indicate that the order of processing of the rows of a
ResultSet is unknown. |
|||||||||
int | HOLD_CURSORS_OVER_COMMIT | A constant used to indicate that a ResultSet object must not be
closed when the method Connection.commit is invoked. |
|||||||||
int | TYPE_FORWARD_ONLY | A constant used to indicate a ResultSet object whose cursor can
only move forward. |
|||||||||
int | TYPE_SCROLL_INSENSITIVE | A constant used to indicate a ResultSet object which is
scrollable but is insensitive to changes made by others. |
|||||||||
int | TYPE_SCROLL_SENSITIVE | A constant used to indicate a ResultSet object which is
scrollable and sensitive to changes made by others. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Moves the cursor to a specified row number in the
ResultSet . | |||||||||||
Moves the cursor to the end of the
ResultSet , after the last row. | |||||||||||
Moves the cursor to the start of the
ResultSet , before the first
row. | |||||||||||
Cancels any updates made to the current row in the
ResultSet . | |||||||||||
Clears all warnings related to this
ResultSet . | |||||||||||
Releases this
ResultSet 's database and JDBC resources. | |||||||||||
Deletes the current row from the
ResultSet and from the
underlying database. | |||||||||||
Gets the index number for a column in the
ResultSet from the
provided column name. | |||||||||||
Shifts the cursor position to the first row in the
ResultSet . | |||||||||||
Gets the value of a column specified by column name as a
java.sql.Array . | |||||||||||
Gets the content of a column specified by column index in the current row
of this
ResultSet as a java.sql.Array . | |||||||||||
Gets the value of a column specified by column name as an ASCII character
stream.
| |||||||||||
Gets the value of a column specified by column index as an ASCII
character stream.
| |||||||||||
This method is deprecated.
use
getBigDecimal(int) or
getBigDecimal(String) | |||||||||||
This method is deprecated.
use
getBigDecimal(int) or
getBigDecimal(String) | |||||||||||
Gets the value of a column specified by column index as a
java.math.BigDecimal . | |||||||||||
Gets the value of a column specified by column name, as a
java.math.BigDecimal . | |||||||||||
Gets the value of a column specified by column index as a binary
stream.
| |||||||||||
Gets the value of a column specified by column name as a binary stream.
| |||||||||||
Gets the value of a column specified by column index as a
java.sql.Blob object. | |||||||||||
Gets the value of a column specified by column name, as a
java.sql.Blob object. | |||||||||||
Gets the value of a column specified by column index as a
boolean
. | |||||||||||
Gets the value of a column specified by column name, as a
boolean
. | |||||||||||
Gets the value of a column specified by column index as a
byte . | |||||||||||
Gets the value of a column specified by column name as a
byte . | |||||||||||
Gets the value of a column specified by column index as a byte array.
| |||||||||||
Gets the value of a column specified by column name as a byte array.
| |||||||||||
Gets the value of a column specified by column index as a
java.io.Reader object. | |||||||||||
Gets the value of a column specified by column name as a
java.io.Reader object. | |||||||||||
Gets the value of a column specified by column name as a
java.sql.Clob . | |||||||||||
Gets the value of a column specified by column index as a
java.sql.Clob . | |||||||||||
Gets the concurrency mode of this
ResultSet . | |||||||||||
Gets the name of the SQL cursor of this
ResultSet . | |||||||||||
Gets the value of a column specified by column name, as a
java.sql.Date object. | |||||||||||
Gets the value of a column specified by column index as a
java.sql.Date . | |||||||||||
Gets the value of a column specified by column name as a
java.sql.Date . | |||||||||||
Gets the value of a column specified by column index as a
java.sql.Date . | |||||||||||
Gets the value of a column specified by column index as a
double
value. | |||||||||||
Gets the value of a column specified by column name as a
double
value. | |||||||||||
Gets the direction in which rows are fetched for this
ResultSet
object. | |||||||||||
Gets the fetch size (in number of rows) for this
ResultSet . | |||||||||||
Gets the value of a column specified by column index as a
float
value. | |||||||||||
Gets the value of a column specified by column name as a
float
value. | |||||||||||
Gets the value of a column specified by column name, as an
int
value. | |||||||||||
Gets the value of a column specified by column index as an
int
value. | |||||||||||
Gets the value of a column specified by column name, as a
long
value. | |||||||||||
Gets the value of a column specified by column index as a
long
value. | |||||||||||
Gets the metadata for this
ResultSet . | |||||||||||
Gets the value of a column specified by column name as a Java
Object . | |||||||||||
Gets the value of a specified column as a Java
Object . | |||||||||||
Gets the value of a column specified by column index as a Java
Object . | |||||||||||
Gets the value of a specified column as a Java
Object . | |||||||||||
Gets the value of a column specified by column name as a Java
java.sql.Ref . | |||||||||||
Gets the value of a column specified by column index as a Java
java.sql.Ref . | |||||||||||
Gets the number of the current row in the
ResultSet . | |||||||||||
Gets the value of a column specified by column index as a short value.
| |||||||||||
Gets the value of a column specified by column name, as a short value.
| |||||||||||
Gets the statement that produced this
ResultSet . | |||||||||||
Gets the value of a column specified by column name, as a String.
| |||||||||||
Gets the value of a column specified by column index as a String.
| |||||||||||
Gets the value of a column specified by column index as a
java.sql.Time value. | |||||||||||
Gets the value of a column specified by column index, as a
java.sql.Time value. | |||||||||||
Gets the value of a column specified by column index as a
java.sql.Time value. | |||||||||||
Gets the value of a column specified by column name, as a
java.sql.Time value. | |||||||||||
Gets the value of a column specified by column name, as a
java.sql.Timestamp value. | |||||||||||
Gets the value of a column specified by column index as a
java.sql.Timestamp value. | |||||||||||
Gets the value of a column specified by column index, as a
java.sql.Timestamp value. | |||||||||||
Gets the value of a column specified by column name, as a
java.sql.Timestamp value. | |||||||||||
Gets the type of the
ResultSet . | |||||||||||
Gets the value of a column specified by column index as a
java.net.URL . | |||||||||||
Gets the value of a column specified by column name as a
java.net.URL object. | |||||||||||
This method is deprecated.
Use
getCharacterStream(int) | |||||||||||
This method is deprecated.
Use
getCharacterStream(int) . | |||||||||||
Gets the first warning generated by calls on this
ResultSet . | |||||||||||
Insert the insert row into the
ResultSet and into the underlying
database. | |||||||||||
Gets if the cursor is after the last row of the
ResultSet . | |||||||||||
Gets if the cursor is before the first row of the
ResultSet . | |||||||||||
Gets if the cursor is on the first row of the
ResultSet . | |||||||||||
Gets if the cursor is on the last row of the
ResultSet | |||||||||||
Shifts the cursor position to the last row of the
ResultSet . | |||||||||||
Moves the cursor to the remembered position, namely the
row that was the current row before a call to
moveToInsertRow . | |||||||||||
Moves the cursor position to the Insert Row.
| |||||||||||
Shifts the cursor position down one row in this
ResultSet object. | |||||||||||
Relocates the cursor position to the preceding row in this
ResultSet . | |||||||||||
Refreshes the current row with its most up to date value in the database.
| |||||||||||
Moves the cursor position up or down by a specified number of rows.
| |||||||||||
Indicates whether a row has been deleted.
| |||||||||||
Indicates whether the current row has had an insertion operation.
| |||||||||||
Indicates whether the current row has been updated.
| |||||||||||
Indicates which direction (forward/reverse) will be used to process the
rows of this
ResultSet object. | |||||||||||
Indicates the number of rows to fetch from the database when extra rows
are required for this
ResultSet . | |||||||||||
Updates a column specified by a column index with a
java.sql.Array value. | |||||||||||
Updates a column specified by a column name with a
java.sql.Array
value. | |||||||||||
Updates a column specified by a column name with an Ascii stream value.
| |||||||||||
Updates a column specified by a column index with an ASCII stream value.
| |||||||||||
Updates a column specified by a column index with a
java.sql.BigDecimal value. | |||||||||||
Updates a column specified by a column name with a
java.sql.BigDecimal value. | |||||||||||
Updates a column specified by a column name with a binary stream value.
| |||||||||||
Updates a column specified by a column index with a binary stream value.
| |||||||||||
Updates a column specified by a column index with a
java.sql.Blob
value. | |||||||||||
Updates a column specified by a column name with a
java.sql.Blob
value. | |||||||||||
Updates a column specified by a column name with a
boolean value. | |||||||||||
Updates a column specified by a column index with a
boolean
value. | |||||||||||
Updates a column specified by a column name with a
byte value. | |||||||||||
Updates a column specified by a column index with a
byte value. | |||||||||||
Updates a column specified by a column name with a byte array value.
| |||||||||||
Updates a column specified by a column index with a
byte array
value. | |||||||||||
Updates a column specified by a column index with a character stream
value.
| |||||||||||
Updates a column specified by a column name with a character stream
value.
| |||||||||||
Updates a column specified by a column name with a
java.sql.Clob
value. | |||||||||||
Updates a column specified by a column index with a
java.sql.Clob
value. | |||||||||||
Updates a column specified by a column name with a
java.sql.Date
value. | |||||||||||
Updates a column specified by a column index with a
java.sql.Date
value. | |||||||||||
Updates a column specified by a column index with a
double value. | |||||||||||
Updates a column specified by a column name with a
double value. | |||||||||||
Updates a column specified by a column index with a
float value. | |||||||||||
Updates a column specified by a column name with a
float value. | |||||||||||
Updates a column specified by a column name with an
int value. | |||||||||||
Updates a column specified by a column index with an
int value. | |||||||||||
Updates a column specified by a column index with a
long value. | |||||||||||
Updates a column specified by a column name with a
long value. | |||||||||||
Updates a column specified by a column index with a
null value. | |||||||||||
Updates a column specified by a column name with a
null value. | |||||||||||
Updates a column specified by a column index with an
Object
value. | |||||||||||
Updates a column specified by a column index with an
Object
value. | |||||||||||
Updates a column specified by a column name with an
Object value. | |||||||||||
Updates a column specified by a column name with an
Object value. | |||||||||||
Updates a column specified by a column index with a
java.sql.Ref
value. | |||||||||||
Updates a column specified by a column name with a
java.sql.Ref
value. | |||||||||||
Updates the database with the new contents of the current row of this
ResultSet object. | |||||||||||
Updates a column specified by a column name with a
short value. | |||||||||||
Updates a column specified by a column index with a
short value. | |||||||||||
Updates a column specified by a column name with a
String value. | |||||||||||
Updates a column specified by a column index with a
String value. | |||||||||||
Updates a column specified by a column index with a
Time value. | |||||||||||
Updates a column specified by a column name with a
Time value. | |||||||||||
Updates a column specified by a column index with a
Timestamp
value. | |||||||||||
Updates a column specified by column name with a
Timestamp value. | |||||||||||
Determines whether the last column read from this
ResultSet
contained SQL NULL . |
A constant used to indicate that a ResultSet
object must be
closed when the method Connection.commit
is invoked.
A constant used to indicate the concurrency mode for a ResultSet
object that cannot be updated.
A constant used to indicate the concurrency mode for a ResultSet
object that can be updated.
A constant used to indicate processing of the rows of a ResultSet
in the forward direction, first to last.
A constant used to indicate processing of the rows of a ResultSet
in the reverse direction, last to first.
A constant used to indicate that the order of processing of the rows of a
ResultSet
is unknown.
A constant used to indicate that a ResultSet
object must not be
closed when the method Connection.commit
is invoked.
A constant used to indicate a ResultSet
object whose cursor can
only move forward.
A constant used to indicate a ResultSet
object which is
scrollable but is insensitive to changes made by others.
A constant used to indicate a ResultSet
object which is
scrollable and sensitive to changes made by others.
Moves the cursor to a specified row number in the ResultSet
.
row | the index of the row starting at index 1. Index -1
returns the last row. |
---|
true
if the new cursor position is on the ResultSet
, false
otherwise.SQLException | if a database error happens. |
---|
Moves the cursor to the end of the ResultSet
, after the last row.
SQLException | if a database error happens. |
---|
Moves the cursor to the start of the ResultSet
, before the first
row.
SQLException | if a database error happens. |
---|
Cancels any updates made to the current row in the ResultSet
.
SQLException | if a database error happens. |
---|
Clears all warnings related to this ResultSet
.
SQLException | if a database error happens. |
---|
Releases this ResultSet
's database and JDBC resources. You are
strongly advised to use this method rather than relying on the release
being done when the ResultSet
's finalize method is called during
garbage collection process. Note that the close()
method might
take some time to complete since it is dependent on the behavior of the
connection to the database and the database itself.
SQLException | if a database error happens. |
---|
Deletes the current row from the ResultSet
and from the
underlying database.
SQLException | if a database error happens. |
---|
Gets the index number for a column in the ResultSet
from the
provided column name.
columnName | the column name. |
---|
ResultSet
identified by column
name.SQLException | if a database error happens. |
---|
Shifts the cursor position to the first row in the ResultSet
.
true
if the position is in a legitimate row, false
if the ResultSet
contains no rows.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a java.sql.Array
.
colName | the name of the column to read. |
---|
java.sql.Array
with the data from the specified column.SQLException | if a database error happens. |
---|
Gets the content of a column specified by column index in the current row
of this ResultSet
as a java.sql.Array
.
columnIndex | the index of the column to read |
---|
java.sql.Array
with the data from the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as an ASCII character stream.
columnName | the name of the column to read |
---|
InputStream
with the data from the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as an ASCII character stream.
columnIndex | the index of the column to read. |
---|
InputStream
with the data from the column.SQLException | if a database error happens. |
---|
This method is deprecated.
use getBigDecimal(int)
or
getBigDecimal(String)
Gets the value of a column specified by column name, as a java.math.BigDecimal
.
columnName | the name of the column to read. |
---|---|
scale | the number of digits after the decimal point |
SQLException | if a database error happens. |
---|
This method is deprecated.
use getBigDecimal(int)
or
getBigDecimal(String)
Gets the value of a column specified by column index as a java.math.BigDecimal
.
columnIndex | the index of the column to read. |
---|---|
scale | the number of digits after the decimal point |
BigDecimal
with the value of the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.math.BigDecimal
.
columnIndex | the index of the column to read. |
---|
BigDecimal
with the value of the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.math.BigDecimal
.
columnName | the name of the column to read. |
---|
SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a binary stream.
This method can be used to read LONGVARBINARY
values. All of the
data in the InputStream
should be read before getting data from
any other column. A further call to a getter method will implicitly close
the InputStream
.
columnIndex | the index of the column to read. |
---|
InputStream
with the data from the column. If the
column value is SQL NULL
, null
is returned.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a binary stream.
This method can be used to read LONGVARBINARY
values. All of the
data in the InputStream
should be read before getting data from
any other column. A further call to a getter method will implicitly close
the InputStream
.
columnName | the name of the column to read. |
---|
InputStream
with the data from the column if the
column value is SQL NULL
, null
is returned.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Blob
object.
columnIndex | the index of the column to read. |
---|
java.sql.Blob
with the value of the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.sql.Blob
object.
columnName | the name of the column to read. |
---|
java.sql.Blob
with the value of the column.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a boolean
.
columnIndex | the index of the column to read. |
---|
boolean
value from the column. If the column is SQL
NULL
, false
is returned.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a boolean
.
columnName | the name of the column to read. |
---|
boolean
value from the column. If the column is SQL
NULL
, false
is returned.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a byte
.
columnIndex | the index of the column to read. |
---|
byte
equal to the value of the column. 0 if the value
is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a byte
.
columnName | the name of the column to read. |
---|
byte
equal to the value of the column. 0 if the value
is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a byte array.
columnIndex | the index of the column to read. |
---|
null
if
the column contains SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a byte array.
columnName | the name of the column to read. |
---|
null
if
the column contains SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.io.Reader
object.
columnIndex | the index of the column to read. |
---|
Reader
holding the value of the column. null
if
the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a java.io.Reader
object.
columnName | the name of the column to read. |
---|
Reader
holding the value of the column. null
if
the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a java.sql.Clob
.
colName | the name of the column to read. |
---|
Clob
object representing the value in the column.
null
if the value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Clob
.
columnIndex | the index of the column to read. |
---|
Clob
object representing the value in the column.
null
if the value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the concurrency mode of this ResultSet
.
ResultSet.CONCUR_READ_ONLY
, ResultSet.CONCUR_UPDATABLE
.SQLException | if a database error happens. |
---|
Gets the name of the SQL cursor of this ResultSet
.
SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.sql.Date
object.
columnName | the name of the column to read. |
---|---|
cal | java.util.Calendar to use in constructing the Date. |
java.sql.Date
matching the column value. null
if the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Date
.
columnIndex | the index of the column to read. |
---|
java.sql.Date
matching the column value. null
if the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a java.sql.Date
.
columnName | the name of the column to read. |
---|
java.sql.Date
matching the column value. null
if the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Date
. This method uses a supplied calendar to compute the Date.
columnIndex | the index of the column to read. |
---|---|
cal | a java.util.Calendar to use in constructing the Date. |
java.sql.Date
matching the column value. null
if the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a double
value.
columnIndex | the index of the column to read. |
---|
double
equal to the column value. 0.0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a double
value.
columnName | the name of the column to read. |
---|
double
equal to the column value. 0.0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the direction in which rows are fetched for this ResultSet
object.
SQLException | if a database error happens. |
---|
Gets the fetch size (in number of rows) for this ResultSet
.
SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a float
value.
columnIndex | the index of the column to read. |
---|
float
equal to the column value. 0.0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a float
value.
columnName | the name of the column to read. |
---|
float
equal to the column value. 0.0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as an int
value.
columnName | the name of the column to read. |
---|
int
equal to the column value. 0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as an int
value.
columnIndex | the index of the column to read. |
---|
int
equal to the column value. 0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a long
value.
columnName | the name of the column to read. |
---|
long
equal to the column value. 0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a long
value.
columnIndex | the index of the column to read. |
---|
long
equal to the column value. 0
if the
column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the metadata for this ResultSet
. This defines the number,
types and properties of the columns in the ResultSet
.
ResultSetMetaData
object with information about this
ResultSet
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a Java Object
.
The type of the Java object will be determined by the supplied Map to perform the mapping of SQL Struct or Distinct types into Java objects.
columnName | the name of the column to read. |
---|---|
map | a java.util.Map containing a mapping from SQL Type names to
Java classes. |
Object
containing the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a specified column as a Java Object
. The type
of the returned object will be the default according to the column's SQL
type, following the JDBC specification for built-in types.
For SQL User Defined Types, if a column value is structured or distinct,
this method behaves the same as a call to: getObject(columnIndex,this.getStatement().getConnection().getTypeMap())
columnName | the name of the column to read. |
---|
Object
containing the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a Java Object
.
The type of the Java object will be determined by the supplied Map to
perform the mapping of SQL Struct
or Distinct types into Java
objects.
columnIndex | the index of the column to read. |
---|---|
map | a java.util.Map containing a mapping from SQL Type
names to Java classes. |
Object
containing the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a specified column as a Java Object
. The type
of the returned object will be the default according to the column's SQL
type, following the JDBC specification for built-in types.
For SQL User Defined Types, if a column value is Structured or Distinct,
this method behaves the same as a call to: getObject(columnIndex,this.getStatement().getConnection().getTypeMap())
columnIndex | the index of the column to read. |
---|
Object
containing the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a Java java.sql.Ref
.
colName | the name of the column to read. |
---|
REF
in the columnSQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a Java java.sql.Ref
.
columnIndex | the index of the column to read. |
---|
SQLException | if a database error happens. |
---|
Gets the number of the current row in the ResultSet
. Row numbers
start at 1 for the first row.
0
is returned if
there is no current row.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a short value.
columnIndex | the index of the column to read. |
---|
0
if
the value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a short value.
columnName | the name of the column to read. |
---|
0
if
the value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the statement that produced this ResultSet
. If the ResultSet
was not created by a statement (i.e. because it was returned
from one of the DatabaseMetaData
methods), null
is
returned.
ResultSet
, or null
if the ResultSet
was not created by a Statement.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a String.
columnName | the name of the column to read. |
---|
null
if
the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a String.
columnIndex | the index of the column to read. |
---|
null
if
the column is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Time
value. The supplied Calendar
is used to
map the SQL Time
value to a Java Time value.
columnIndex | the index of the column to read. |
---|---|
cal | a Calendar to use in creating the Java Time value. |
null
if the column
value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index, as a java.sql.Time
value. The supplied Calendar
is used to
map the SQL Time
value to a Java Time value.
columnName | the name of the column to read. |
---|---|
cal | a Calendar to use in creating the Java time value. |
null
if the column
value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Time
value.
columnIndex | the index of the column to read. |
---|
null
if the column
value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.sql.Time
value.
columnName | the name of the column to read. |
---|
null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.sql.Timestamp
value.
columnName | the name of the column to read. |
---|
null
if the
column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index as a java.sql.Timestamp
value.
columnIndex | the index of the column to read. |
---|
null
if the
column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column index, as a java.sql.Timestamp
value. The supplied Calendar is used when mapping
the SQL Timestamp
value to a Java Timestamp
value.
columnIndex | the index of the column to read. |
---|---|
cal | Calendar to use in creating the Java timestamp value. |
null
if the
column value is SQL NULL.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name, as a java.sql.Timestamp
value. The supplied Calendar is used when mapping
the SQL Timestamp
value to a Java Timestamp
value.
columnName | the name of the column to read. |
---|---|
cal | Calendar to use in creating the Java Timestamp value. |
null
if the
column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the type of the ResultSet
.
ResultSet
type, one of:
ResultSet.TYPE_FORWARD_ONLY
ResultSet.TYPE_SCROLL_INSENSITIVE
ResultSet.TYPE_SCROLL_SENSITIVE
SQLException | if there is a database error. |
---|
Gets the value of a column specified by column index as a java.net.URL
.
columnIndex | the index of the column to read. |
---|
null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the value of a column specified by column name as a java.net.URL
object.
columnName | the name of the column to read. |
---|
null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
This method is deprecated.
Use getCharacterStream(int)
Gets the value of the column as an InputStream
of Unicode
characters.
columnName | the name of the column to read. |
---|
InputStream
holding the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
This method is deprecated.
Use getCharacterStream(int)
.
Gets the value of the column as an InputStream
of unicode
characters.
columnIndex | the index of the column to read. |
---|
InputStream
holding the value of the column. null
if the column value is SQL NULL
.SQLException | if a database error happens. |
---|
Gets the first warning generated by calls on this ResultSet
.
Subsequent warnings on this ResultSet
are chained to the first
one.
The warnings are cleared when a new Row is read from the ResultSet
. The warnings returned by this method are only the warnings
generated by ResultSet
method calls - warnings generated by
Statement methods are held by the Statement.
An SQLException
is generated if this method is called on a closed
ResultSet
.
ResultSet
. null
if there are no warnings.SQLException | if a database error happens. |
---|
Insert the insert row into the ResultSet
and into the underlying
database. The cursor must be set to the Insert Row before this method is
invoked.
SQLException | if a database error happens. Particular cases include the cursor not being on the Insert Row or if any columns in the row do not have a value where the column is declared as not-nullable. |
---|
Gets if the cursor is after the last row of the ResultSet
.
true
if the cursor is after the last row in the ResultSet
, false
if the cursor is at any other position
in the ResultSet
.SQLException | if a database error happens. |
---|
Gets if the cursor is before the first row of the ResultSet
.
true
if the cursor is before the first row in the ResultSet
, false
if the cursor is at any other position
in the ResultSet
.SQLException | if a database error happens. |
---|
Gets if the cursor is on the first row of the ResultSet
.
true
if the cursor is on the first row in the ResultSet
, false
if the cursor is at any other position
in the ResultSet
.SQLException | if a database error happens. |
---|
Gets if the cursor is on the last row of the ResultSet
true
if the cursor is on the last row in the ResultSet
, false
if the cursor is at any other position
in the ResultSet
.SQLException | if a database error happens. |
---|
Shifts the cursor position to the last row of the ResultSet
.
true
if the new position is in a legitimate row, false
if the ResultSet
contains no rows.SQLException | if there is a database error. |
---|
Moves the cursor to the remembered position, namely the
row that was the current row before a call to moveToInsertRow
.
This only applies if the cursor is on the Insert Row.
SQLException | if a database error happens. |
---|
Moves the cursor position to the Insert Row. The current position is
remembered and the cursor is positioned at the Insert Row. The columns in
the Insert Row should be filled in with the appropriate update methods,
before calling insertRow
to insert the new row into the database.
SQLException | if a database error happens. |
---|
Shifts the cursor position down one row in this ResultSet
object.
Any input streams associated with the current row are closed and any warnings are cleared.
true
if the updated cursor position is pointing to a
valid row, false
otherwise (i.e. when the cursor is after
the last row in the ResultSet
).SQLException | if a database error happens. |
---|
Relocates the cursor position to the preceding row in this ResultSet
.
true
if the new position is in a legitimate row, false
if the cursor is now before the first row.SQLException | if a database error happens. |
---|
Refreshes the current row with its most up to date value in the database. Must not be called when the cursor is on the Insert Row.
If any columns in the current row have been updated but the updateRow
has not been called, then the updates are lost when this
method is called.
SQLException | if a database error happens., including if the current row is the Insert row. |
---|
Moves the cursor position up or down by a specified number of rows. If the new position is beyond the start row (or end row), the cursor position is set before the first row (or, respectively, after the last row).
rows | a number of rows to move the cursor - may be positive or negative |
---|
true
if the new cursor position is on a row, false
otherwiseSQLException | if a database error happens. |
---|
Indicates whether a row has been deleted. This method depends on whether the JDBC driver and database can detect deletions.
true
if a row has been deleted and if deletions are
detected, false
otherwise.SQLException | if a database error happens. |
---|
Indicates whether the current row has had an insertion operation. This method depends on whether the JDBC driver and database can detect insertions.
true
if a row has been inserted and if insertions are
detected, false
otherwise.SQLException | if a database error happens. |
---|
Indicates whether the current row has been updated. This method depends on whether the JDBC driver and database can detect updates.
true
if the current row has been updated and if updates
can be detected, false
otherwise.SQLException | if a database error happens. |
---|
Indicates which direction (forward/reverse) will be used to process the
rows of this ResultSet
object. This is treated as a hint by the
JDBC driver.
direction | can be ResultSet.FETCH_FORWARD , ResultSet.FETCH_REVERSE , or ResultSet.FETCH_UNKNOWN |
---|
SQLException | if there is a database error. |
---|
Indicates the number of rows to fetch from the database when extra rows
are required for this ResultSet
. This used as a hint to the JDBC
driver.
rows | the number of rows to fetch. 0 implies that the JDBC
driver can make its own decision about the fetch size. The
number should not be greater than the maximum number of rows
established by the statement that generated the ResultSet . |
---|
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.Array
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.Array
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with an Ascii stream value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
length | the length of the data to write from the stream |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with an ASCII stream value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
length | the length of the data to write from the stream |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.BigDecimal
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.BigDecimal
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a binary stream value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
length | he number of bytes to be read from the the stream. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a binary stream value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
length | the number of bytes to be read from the the stream. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.Blob
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.Blob
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a boolean
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a boolean
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a byte
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a byte
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a byte array value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a byte
array
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a character stream value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
length | the length of data to write from the stream |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a character stream value.
columnName | the name of the column to update. |
---|---|
reader | the new value for the specified column. |
length | the length of data to write from the Reader |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.Clob
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.Clob
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.Date
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.Date
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a double
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a double
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a float
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a float
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with an int
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with an int
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a long
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column.. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a long
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a null
value.
columnIndex | the index of the column to update. |
---|
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a null
value.
columnName | the name of the column to update. |
---|
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with an Object
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with an Object
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
scale | for the types java.sql.Types.DECIMAL or java.sql.Types.NUMERIC , this specifies the number of digits
after the decimal point. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with an Object
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with an Object
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
scale | for the types java.sql.Types.DECIMAL or java.sql.Types.NUMERIC , this specifies the number of digits
after the decimal point. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a java.sql.Ref
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a java.sql.Ref
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates the database with the new contents of the current row of this
ResultSet
object.
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a short
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a short
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a String
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a String
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a Time
value.
columnIndex | the index of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column name with a Time
value.
columnName | the name of the column to update. |
---|---|
x | the new value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by a column index with a Timestamp
value.
columnIndex | the index of the column to update. |
---|---|
x | the new timestamp value for the specified column. |
SQLException | if a database error happens. |
---|
Updates a column specified by column name with a Timestamp
value.
columnName | the name of the column to update. |
---|---|
x | the new timestamp value for the specified column. |
SQLException | if a database error happens. |
---|
Determines whether the last column read from this ResultSet
contained SQL NULL
.
{@code true
if the last column contained SQL NULL
, false
otherwiseSQLException | if a database error happens. |
---|