April 2018
Intermediate to advanced
202 pages
4h 48m
English
As you can see, the execute method of the Statement class returns a ResultSet object. A ResultSet object represents data from the database. It works like a cursor pointing to the rows in the data. First, the cursor is placed before the first row. You can use the next method to iterate through the rows as follows:
while (resultSet.next()) { String content = resultSet.getString("content"));}
In the previous example, we are using the getString method to get the value that corresponds to the content column. There are methods for various data types: for example, the getInt method returns the value in the specified column as a Java int.
Read now
Unlock full access