Tag Archives: java.sql.SQLException: Exhausted Resultset

Java.sql.sqlexception: an analysis of the causes of exhausted resultset

Open source software supply chain lighting plan, waiting for you>>>

java.sql.SQLException: Exhausted Resultset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError. java:113 )
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError. java:147 )

The reason for this error is that the resultset cursor pointer is out of the last element, which indicates that either the resultset set is empty , or the set has no elements to read . At this time, you call rs.get() to get the element, and an error will be reported

if (rs! = null) {
  while (rs.next()) {
    count = rs.getInt(1);
  }
  count = rs.getInt(1); //this will throw Exhausted resultset
}