java.sql.ResultSet.next()
Moves the cursor forward one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or throw an SQLException on a subsequent call to next.
If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.
Returns:
true if the new current row is valid; false if there are no more rows
Throws:
SQLException - if a database access error occurs or this method is called on a closed result set
即執行Java sql語句得到一個resultset之后。直接去獲取結果集的內容是無法獲取到數據的。因為一個結果集的光標是停留在第一行前面的。你要處理第一行的數據,就首先ResultSet.next(),將光標移動到第一行。如果光標已經超出有效行數,會報SQLException