Overview of Querying for Data in Oracle Database

In outline, to query Oracle Database 12c Release 2 (12.2) from a Java class to retrieve data, you must do the following:

  1. Create a connection by using the OracleDataSource.getConnection method.
  2. Define your SQL statements with the methods available for the connection object. The createStatement method is used to define a SQL query statement.

  3. Using the methods available for the statement, run your queries. You use the executeQuery method to run queries on the database and produce a set of rows that match the query conditions. These results are contained in a ResultSet object.

  4. You use a ResultSet object to display the data in the application pages.

The following sections describe important Java Database Connectivity (JDBC) concepts related to querying the database from a Java application: