Fetch out of sequence error

  • Share
  • Share

Applies to:
NA

Description:
Occurs when fetching values for columns more than once.

Cause:
This type of error happens because your JDBC driver only supports fetching values for columns once AND in the order that they appear in your ResultSet. For example:
while (rs.next()){
rs.getString(1);
rs.getString(3);
rs.getString(3);// error happens here
rs.getString(2);// error would also happen here
}

JAVA-JDBC , ,

  1. admin
    March 20th, 2009 at 10:28 | #1

    The way to avoid this is to call the getXXX methods on each row in the order they appear in your result set and to only call them each once. If you need to look at these values again you should use a Collection to hold the values from your row.

  1. No trackbacks yet.