This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes invalid cursor state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invalid cursor state