Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases and the fly likes the JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "the JDBC "invalid state cursor" error" Watch "the JDBC "invalid state cursor" error" New topic
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31683
    
189

Aman,
You need to call rs.next() before rs.getInt().


[OCA 8 book] [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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31683
    
189

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: the JDBC "invalid state cursor" error