Retrieving data using SELECT

You can retrieve data using the executeQuery method of a PreparedStatement, which queries the database with a user-defined SQL statement. This method returns the query result as a ResultSet. The ResultSet can then be traversed to fetch the queried data.

 Navigating the ResultSet object
 Retrieving data using a ResultSet