Title: Executing select queries
Course: CPS 189: Java Certification - Review, Practice & Prepare (Development) > Section: (OLDstyle) Learning Modules

Executing select queries

A select query requires:

A Statement object created from the connected database.

A string containing a query of the connected database.

A ResultSet object to contain any rows returned from the query.

Statement statement = connection.createStatement();

ResultSet resultSet = statement.executeQuery(<select-query-string>);

The ResultSet interface contains the following for selecting and moving among data in a result set:

- Navigation methods for moving among rows.

- Get methods for retrieving column data.

- Test methods for testing row status.

For more information, see:

Processing SQL Statements with JDBC

Level 1 Study Materials: Unit 7

Level 1 Study Materials: Unit 8