Saturday, August 27, 2011

java.sql.SQLException: ResultSet.next was not called



Problem:
This is one of the Common Exceptions which we come across almost daily in our lives. I encountered this issue when trying to iterate from a resultset.

Exception i encountered was:
"java.sql.SQLException: ResultSet.next was not called
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:208)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.jav
a:511)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)
at TestingVCMIDChannel.getChannelVCMIDwithChannelName(TestingVCMIDChanne
l.java:111)
at TestingVCMIDChannel.main(TestingVCMIDChannel.java:217)"

Solution:
I did a terrible mistake of calling the results method out of the while loop where i was iterating the results set. Do check the results.getValue() here, do let me know if you too faced the same issue.
Please let me know if you still encounter this issue, mail me @ rahamat_234@yahoo.com


Similar Exceptions:

- java.sql.SQLException: ResultSet.next was not called
- oracle.jdbc.driver.DatabaseError.throwSqlException
- oracle.jdbc.driver.OracleResultSetImpl.getInt