Chapter 6. Introducing the JDBC Technology and Oracle’s Implementation
JDBC Primer
Before diving into the details, let’s first introduce the technology. Readers who are already familiar with JDBC may want to skip this section, or revisit it!
First Steps in JDBC
The basic JDBC steps include loading and registering the driver, connecting to the database, creating a statement object, executing the query, processing the results, and closing the resources.
Step 1: Loading and Registering the Driver
Loading and registering the driver can be achieved in your code using either DriverManager.registerDriver
or Class.forName
; in case something goes wrong, the first method throws a SQLException
and the second throws a ClassNotFoundException
:
DriverManager.registerDriver ...
Get Oracle Database Programming using Java and Web Services now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.