Krishna Kuchibhotla

Integrating Databases with Java via JDBC

Javaworld, December 1998

The Java Database Connectivity (JDBC) Application Programming Interface (API) specification is a standard data access interface, developed by Sun and its Java partners. This API provides Java programmers with universal access to a wide range of relational databases. JDBC is a standard part of the Java 2 Platform. The JDBC API defines Java classes to represent database connections, SQL statements, result sets, database metadata, etc. It allows a Java programmer to issue SQL statements and process the results. JDBC is the primary API for database access in Java. The JDBC API is implemented via a driver manager that can support multiple drivers connecting to different databases. JDBC drivers can either be entirely written in Java so that they can be downloaded as part of an applet, or they can be implemented using native methods to bridge to existing database access libraries.

The truth is that everything that you can do in C++, you can do in Java. The following are some of the reasons why vendors are seeking java applications:

Java's portability and security as the prime reason to replace the current programming languages in their main development environment. It is intended to fill the current vacancy in this level of connectivity that has prompted companies to develop proprietary interfaces. JDBC creates a programming-level interface for communicating with databases in a uniform manner similar in concept to Microsoft's Open Database Connectivity (ODBC) component, which has become the standard for personal computers and LANs. The JDBC standard itself is based on the X/Open SQL Call Level Interface, the same basis as that of ODBC. JDBC borrows the Uniform Resource Locator (URL) syntax for globally unique database.

JDBC's URL structure is very similar: jdbc:odbc://host.domain.com:400/databasefile. Note that in addition to the main schema, JDBC, this structure also includes a subprotocol for ODBC. The subprotocol indicates how the JDBC Manager will access the database; in this case, the database file is accessed through the JDBC-ODBC bridge. The rest is the same as for regular URLs, indicating the hostname, port, and database location and name. Platform neutrality of Java is an advantage form a programmer's point of view. Vendors like Oracle, IBM, Sybase, SAS, and Borland have been taking a careful look at the Java-DBMS integration methodology.

To sum up, JDBC follows an established specification and tried implementation for database-neutral communications from applications. JDBC is still in the germination stage. Any fruits of this labor may be seen later this year when the vendors are ready