November 2006
Intermediate to advanced
224 pages
3h 29m
English
ResultSet rs = stmt.executeQuery( "SELECT name, password FROM users where name='tim'"); while (rs.next( )) { String name = rs.getString(1); String password = rs.getString(2); } |
A JDBC query returns a ResultSet object. A ResultSet represents a table of data containing the results of a database query. We can step through the ResultSet contents to get the results of the executed query. The ResultSet maintains a cursor that points to the current row of data. The ResultSet object has a next() method, which moves the cursor to the next row. The next() method will return false when there are no more rows in the ResultSet object. This makes it easy to use a while loop for stepping through all the rows contained within a ...
Read now
Unlock full access