Home

resultset

ResultSet is an interface in the Java Database Connectivity (JDBC) API that represents the data returned by executing a SQL query. It presents data as a table of rows and columns and maintains a cursor for navigating the rows.

A ResultSet is produced by executing a Statement or PreparedStatement with executeQuery. By default most drivers

Data is accessed through getter methods like getInt, getString, or getObject, using either a 1-based column

If the ResultSet is updatable, it supports updateRow, insertRow, deleteRow, and moveToInsertRow; otherwise it is read-only.

Resource management: ResultSet should be closed when no longer needed to free database resources. It is typically

Limitations and portability: feature support depends on the database and driver; some features such as scrollability

provide
a
forward-only
ResultSet,
but
can
be
created
as
scrollable
(TYPE_SCROLL_INSENSITIVE
or
TYPE_SCROLL_SENSITIVE)
and
with
different
concurrency
modes
such
as
CONCUR_READ_ONLY
or
CONCUR_UPDATABLE.
index
or
a
column
label.
The
wasNull
method
indicates
whether
the
last
read
value
was
SQL
NULL.
ResultSetMetaData
describes
column
count,
names,
labels,
and
data
types.
The
cursor
can
be
moved
with
next,
and
for
scrollable
results,
absolute,
relative,
and
other
navigation
methods
are
available.
closed
automatically
when
its
Statement
or
Connection
is
closed,
and
it
is
common
to
use
try-with-resources
to
ensure
proper
closure.
and
updatability
may
be
not
supported.
In
practice,
results
can
be
large,
so
developers
may
prefer
pagination.