I am a new developer in JSP and Java. I am building a site using JSP and running an SQL statement the following
String Search = "Select claimNo from claim;";
Statement stmt1 =con.createStatement();
ResultSet res = stmt1.executeQuery(Search);
res.first();
int r=0;
while (res.next())
{
r = res.getInt("claimNo");
}
res.close();
out.println(r);
Result set type is TYPE_FORWARD_ONLY. From my research, I understand that a result set can be scrollable or Type_Forward_Only. I tried by initializing the result set to res.first(); before using the result set, but I am still getting the error message.
If I use while (res.last()) I am still receiving the same message. I really want to loop through the result set to the last tuple in my database.
Can anyone help resolve this problem?
![]()


Reply With Quote


Bookmarks