• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the JDBC "invalid state cursor" error

 
Aman Agarwal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting an error when executing this section of code
ResultSet rs=st.executeQuery("select * from crawl where enteredURL='"+inputurl+"'");
int a = rs.getInt("ID");

the error is invalid state cursor.
can anyone help me out to eliminate the error?
it will of immense help!!

PS: ID(type integer) is a field name in table "crawl" and enteredURL(type : text) is another field in the same table..these are the only fields in table "crawl"
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aman,
You need to call rs.next() before rs.getInt().
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Almost forgot - Welcome to JavaRanch!
 
Aman Agarwal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah thanks ...got the code rectified and it's working now...
thank you for your help!!!

[replace tnks by thank you, 4 by for, n by and]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic