Skip to content
Advertisement

java.sql.SQLException: Exhausted Resultset

I get the error java.sql.SQLException: Exhausted ResultSet to run a query against an Oracle database. The connection is via a connection pool defined in Websphere. The code executed is as follows:

if (rs! = null) (
    while (rs.next ()) (
        count = rs.getInt (1);
    )
)

I note that the resultset contains data (rs.next ())

Thanks

Advertisement

Answer

I’ve seen this error while trying to access a column value after processing the resultset.

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

Hope this will help you 🙂

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement