JDBC from JavaSoft is a Java API that is used to execute SQL statements. This API provides a set of common vendor-neutral classes and interfaces to enable database access to different databases from Java applications. You can access not only databases but also spreadsheets and flat files using this API. Also, you can use the JDBC API in various Java applications, whether JSPs, servlets, EJBs, or even pure Java applications. The JDBC specification, first released in May 1996, is structurally and conceptually similar to Microsoft's ODBC (Open Database Connectivity) driver. ODBC is built upon the X/Open CLI specification. JDBC is not a replacement for ODBC but an alternative method for accessing a database. This Java language API is platform independent because it runs on the JVM, whereas ODBC is a native interface, and calls to it must access native libraries (such as DLLs). JDBC is similar to the ActiveX Data Object (ADO) or Data Access Object (DAO) wrappers of ODBC, wherein no pointers are used to access the database, but an object-oriented method of using APIs is utilized. Also, unlike ODBC drivers, JDBC drivers need not be installed on the client machine but can be downloaded from the server. Since this is possible, it is not necessary to install expensive proprietary software on the client machine. The first version of the JDBC API, which was released around 1995, was JDBC version 1.x. The second major release, JDBC 2.x, had improved Array, BatchUpdateException, Blob, Clob, Ref, SQLData, SQLInput, SQLOutput, and Struct functions in the java.sql package. JDBC 3.0 was released in February 2002. However, WebLogic 7.0 uses JDK 1.3.1, which supports JDBC 2.0. JDBC has grown to be an alternative to data-retrieving CGI programs. JDBC also uses protocols other than the HTTP protocol, such as IIOP, TDS (Tabular Data Stream), and many other standards. Firewalls may not be configured to recognize native database protocols other than the HTTP protocol in an Internet environment. Hence, there may be problems in accessing a database through a firewall. A JDBC application essentially consists of two layers:
From Figure 7.1, you can see that there are four types of drivers in JDBC. However, these are all based on two models:
Figure 7.1. Driver types and their uses. |