How do I get only the first row from a ResultSet? I know how to iterate through the entire set, but how do I get just the first row?
ResultSet
You can use absolute to navigate to the first row:
absolute
ResultSet rs = ...; rs.absolute(1); // Navigate to first row int id = rs.getInt("id"); ...