aspose file tools
The moose likes JDBC and the fly likes the JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 26195
    
  66

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
    
  66

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: the JDBC "invalid state cursor" error
 
Similar Threads
Writing File(Excel) in ResultSet
JDBC & SQL Error List Help
Display error when record not found
connection problem
Invalid cursor state?