1. Learn
  2. /
  3. Courses
  4. /
  5. Querying a PostgreSQL Database in Java

Connected

Exercise

Data in a ResultSet

Now that CityBook Libraries can execute queries, you need to extract the actual data from the ResultSet. A ResultSet works like a cursor that moves row by row, and you retrieve column values using getter methods.

Extract the title and publication_year from each book in the results. All necessary imports are available for you.

Instructions

100 XP
  • Move through each row in the ResultSet.
  • Retrieve the title and publication_year columns using the appropriate getter methods.