wood burning stoves 2.0*
The moose likes JDBC and the fly likes SQLException Exhausted resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLException Exhausted resultset" Watch "SQLException Exhausted resultset" New topic

SQLException Exhausted resultset

Padmanabh Sahasrabudhe
Ranch Hand

Joined: Mar 04, 2008
Posts: 53
Hi All,

I went thru' the earlier question posted on the forum and applied all the workaround fixes in my code but I am still seeing this issue. Can anybody help me?

When I make this query I get one row returned from the sqlplus prompt.
I also tried using the column name instead of int 1 in getObject. Also how can I make sure that I close all the earlier resultsets and statement called from this code?
This is the stacktrace till my class it called:
java.sql.SQLException: Exhausted Resultset
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:813)
at oracle.jdbc.driver.OracleResultSet.getObject(OracleResultSet.java:458)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getObject(Unknown Source)

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

That exception tells me that the query returned zero records (not one record, but zero). Calling "rs.next()" moved the result set cursor to the end of file, since there were no records. Then trying to use the record at that cursor location caused the exception to be thrown.

As for making sure the result set is closed, you should put the "rs.close()" call, and the others, into a finally block. Here's a link to Sun's tutorial about that:

The finally Block
I agree. Here's the link: http://aspose.com/file-tools
subject: SQLException Exhausted resultset