java.sql.SQLException: Exhausted Resultset缘由分析

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

出现这个错误的缘由是由于ResultSet curser 指针已经在最后一个元素以外了,说明要么是ResultSet 集合为空,要么是集合已经没有能够读取的元素了,此时你再调用rs.get()获取元素,就会报错。sql

if (rs! = null) {
  while (rs.next()) {
    count = rs.getInt(1);
  }
  count = rs.getInt(1); //this will throw Exhausted resultset
}
相关文章
相关标签/搜索