SQL Statements

Once you connect to the database and, in the process, create a Connection object, the next step is to create a Statement object. The createStatement method of the JDBC Connection object returns an object of the JDBC Statement type. The following example shows how to create a Statement object.

Example 4-1 Creating a Statement Object

Statement stmt = conn.createStatement();

The Statement object is used to run static SQL queries that can be coded into the application.

In addition, for scenarios where many similar queries with differing update values must be run on the database, you use the OraclePreparedStatement object, which extends the Statement object. To access stored procedures on Oracle Database 12c Release 1 (12.1), you use the OracleCallableStatement object.