My guess is the first calls to getString(1) and getString(2) moved the result set cursor forward and you cannot automatically move it back again just by calling getString(1) and getString(2) again without moving to the next row...but you're already on the last row since you've exited your while(rs.next()) loop. By default a JDBC ResultSet is like an iterator...each call to rs.next() moves the cursor forward one row and you can't move backwards. I would suggest taking a few minutes to read the Javadoc for the ResultSet interface. There is one part in there in particular which says "For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once." You problem is probably related to this in that you are trying to read the same values from the last row of the result set twice. Read the columns once (in your loop) and store them in String reference variables.