• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am getting error like ResultSet is not clled....plz help

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the piece of code and error stack are

while(res.next())
{
PreparedStatement pstmt = con.prepareStatement("select count(*) from TB_USER where USER_ID = ?");
pstmt.setInt(1,res.getInt(1));
ResultSet count = pstmt.executeQuery();
pstmt3.setInt(1,res.getInt(1));
ResultSet date = pstmt3.executeQuery();
if(count.getInt(1)==0) // java:65
{

Errors
-----------
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.java:517)
at com.Murthy.First.updateOracleTables(First.java:65)
at com.Murthy.First.main(First.java:127) }
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, it sounds like a JDBC question. However, you need to call count.next(), before count.getInt() and date.next() before date.getXxx() method. Since, the cursor is not set to the first record, one needs to call next() method to place the cursor on the first record.

Cheers.

NOTE: Please name your variable carefully, so it wouldn't deceive anyone by its name.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And please UseRealWords .
words like "clled" and "p l z" are only meant to confuse others and result in less response for your question.
 
reply
    Bookmark Topic Watch Topic
  • New Topic