This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes invalid cursor state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "invalid cursor state" Watch "invalid cursor state" New topic
Author

invalid cursor state

Naadir Peterson
Ranch Hand

Joined: Sep 22, 2004
Posts: 37
gettin an invalid cursor state exception when i try to get a record from the database using jsp..
its like:

ResultSet attempt = statement.executeQuery("SELECT Attempts FROM Users WHERE UserName = '" + username + "'");
String attemptTry = attempt.getString("Attempts");

i think the problem is the getString method
the "Attempts" is named right way out of the DB...
the resultset does return something but i still get the error

Attempts is a smallint in the database.. is it coz of that?
thanx
Santosh Jagtap
Greenhorn

Joined: Sep 20, 2004
Posts: 23
Hi
try this
ResultSet attempt = statement.executeQuery("SELECT Attempts FROM Users WHERE UserName = '" + username + "'");
attempt.next();
String attemptTry = attempt.getString("Attempts");


Santy
 
 
subject: invalid cursor state