PreparedStatement
is an object that represents a precompiled SQL statement, that can be used to execute the statement multiple times
efficiently.
ResultSet
is the Java representation of the result set of a database query obtained from a Statement
object. A default
ResultSet
object is not updatable and has a cursor that moves forward only.
The parameters in PreparedStatement
and ResultSet
are indexed beginning at 1, not 0. When an invalid index is passed to
the PreparedStatement
or ResultSet
methods, an IndexOutOfBoundsException
is thrown. This can cause the program
to crash or behave unexpectedly, leading to a poor user experience.
This rule raises an issue for the get
methods in PreparedStatement
and the set
methods in
ResultSet
.