JDBC: Java DataBase Connectivity

At this point, we’ve installed the JDK, and we have a little experience using HTML, applets, standalone Java programs, .jar files, and the standard environment variables. Let’s get on with the real business of doing useful work with Oracle. First, we need to acquire the drivers needed to connect Oracle and Java via JDBC (Java DataBase Connectivity). JDBC, which we described briefly in Chapter 2, is Java’s answer to ODBC (Open DataBase Connectivity).

java.sql Drivers for JDBC and Oracle

The first thing we need to do is to get hold of the appropriate Oracle connectivity drivers. Because the download pages for these drivers tend to be quite fluid, the best way to get the code is to first access the Oracle Technology Network (OTN). (You may need to register there beforehand as a developer, if you haven’t done so already, as described in the preface.) Visit the following site, and search for “Java” and/or “JDBC”. The download pages for the relevant Oracle JDBC drivers should reveal themselves in any search results:

http://technet.oracle.com

Types of drivers

There are four types of drivers for generic JDBC database use, two Fat and two Thin. Fat drivers for any database type require access to native code libraries, such as OCI, at the client end. Thin drivers are entirely encapsulated and do not require anything outside of themselves to connect Java to a target database (these differing characteristics are displayed in Figure 7-5). This makes them especially ...

Get Oracle and Open Source 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.