In outline, to query Oracle Database 12c Release 2 (12.2) from a Java class to retrieve data, you must do the following:
OracleDataSource.getConnection
method.
Define your SQL statements with the methods available for the connection object. The createStatement
method is used to define a SQL query statement.
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.
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: