Using the ResultSet Interface
The following must be considered when using the
ResultSet
interface:
-
Before reading any values, you must call
next()
. This returns true if there is a result, but more importantly, it prepares the row for processing. -
You must close a
ResultSet
by callingclose()
once you have finished using it. -
Once you make another query with the
Statement
used to create aResultSet
, the currently openResultSet
instance is closed automatically. -
When PreparedStatement API is used,
ResultSet
switches to binary mode after five query executions (this default is set by theprepareThreshold
connection property, see Server Prepared Statements ). This may cause unexpected behavior when some methods are called. For example, results on method calls such asgetString()
on non-string data types, while logically equivalent, may be formatted differently after execution exceeds the setprepareThreshold
when conversion to object method switches to one matching the return mode.