Possible Duplicate:
rs.last() gives Invalid operation for forward only resultset : last
So I'm trying to understand the result set cursor and I'm having an issue with where the cursor is apparently.
I have a very small application that assigns a new integer id automatically, which will be the last entry into the database, therefore the highest integer. I'm trying to get to the last entry like this (rs is result set) so I can use its value:
rs.last
and then assigning the_new_id to rs.getInt(1)...
However, I get the "Invalid operation for forward only resultset : last" sql exception.
Right now I have a big "kludge" to make this work:
while(rs.next())
your_new_id = rs.getInt(1);
and then I just assign the new id that way. :-\
How can I implement this same behavior more elegantly using last?
Any help is appreciated.