| Author |
the JDBC "invalid state cursor" error
|
Aman Agarwal
Greenhorn
Joined: Apr 04, 2010
Posts: 3
|
|
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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26195
|
|
Aman,
You need to call rs.next() before rs.getInt().
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26195
|
|
|
Almost forgot - Welcome to JavaRanch!
|
 |
Aman Agarwal
Greenhorn
Joined: Apr 04, 2010
Posts: 3
|
|
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]
|
 |
 |
|
|
subject: the JDBC "invalid state cursor" error
|
|
|