This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLException Exhausted resultset

 
Padmanabh Sahasrabudhe
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

Thanks,
 
Paul Clapham
Sheriff
Pie
Posts: 20950
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic