Connecting to the Database
The hardest thing about using JDBC is usually getting the JDBC drivers to connect to the database in the first place. The principle difficulty is because we need to get three different things working together: our Oracle database, our Java development environment, and the JDBC drivers to connect the Oracle database and our Java programs.
There are numerous options and alternatives for connecting, many of which we'll explore in the next chapter, but for now we'll start with the basics. These are the steps required to connect to the database:
- Setting up the Oracle, Java, and JDBC environment
- Importing the JDBC classes we need
- Loading and registering the JDBC driver
- Getting a Connection object from the driver
Setting up the ...
Get Java™ Oracle® Database Development 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.