JDBC connectivity


The need of JDBC

Java has been called "the vehicle by which developers will be able to bring dynamic application behavior to the Web" . Users can download applets from either local or remote Web servers for execution inside popular Web browsers such as Netscape Navigat or. Applets run disconnected from the server, just like native applications. Java however, has fallen short of its widely ability to connect to outside resources via a build-in API. The first release of the Java Developers Kit (JDK) in early 1995 had no i ntegrated support for accessing databases. The functionality of Java made it easy to build tools for accessing databases, but there was no prescription about how such drivers ought to function. Several vendors produced good tools for database access but t here were no general guidelines for how database access tools should be written.

JavaSoft responded with the first release of the JDBC specification in May, 1996. The advent of JDBC means an end to those shortcomings mentioned. JDBC provides a vendor-neutral, universal framework for vendors to use in building tools that allow clien ts to access databases. The JDBC specification itself is just a collection of interfaces and abstract classes that each vendor must implement to write a JDBC-compliant driver. JDBC promises to database-enable any Java applet or application. It is included in the java.sql.package, which will be part of the Java Developers Kit (JDK) version 1.1.

JDBC Functionality

The JDBC API standard defines a set of Java classes required to perform standard relational database operations such as managing database connections, SQL statements, result sets, and metadata. JDBC specification has structural and conceptual similarit ies with Microsofts Open Database Connectivity (ODBC) driver, which Microsoft introduced in the 1980s to bring some conformity to client access to databases. It is based on the X/Open SQL Call Level Interface (CLI), the basis of ODBC. Like ODBC, JDBC giv es Java developers a common API to most relational databases, including client/server databases such as Oracle, Sybase, and Informix. The big difference is that JDBC builds on and reinforces the style and virtues of Java, and is easy to use.

JDBC sends a request to a database server using the appropriate SQL dialect and then processes the results (answer set). Using JDBC, it is easy to send SQL statements to virtually any relational database. It means that with the JDBC API it isnt necess ary to write one program to access a Sybase database, another program to access an Informix database, another program to access an Oracle database, and so on. A single program using the JDBC API can be written, and the program will be able to send SQL sta tements to the appropriate database.

Furthermore, with an application written in Java programming language, the programmer also doesnt have to worry about writing different applications to run on different platforms. The combination of Java and JDBC lets a programmer write it once and ru n it anywhere. Developers writing database access client applications for heterogeneous networks like being able to write one application that will run anywhere; that shortens the development process and makes application maintenance much easier than in t he traditional C/C++ world.

Like ODBC, the JDBC API uses a driver manager that simultaneously supports multiple database drivers for various databases. The driver(s) can be downloaded with the applet or exist as native drivers on the client, depending on how the security features of JDBC and Java will be implemented.

JDBC is a low-level interface used to invoke SQL commands, and it was also designed to be a base upon which to build higher-level interfaces and tools. A higher-level interface is user-friendly, and is translated into a low-level interface, such as JDB C. Later on I will mention two kinds of higher-level APIs under development on top of JDBC.

In summary, JDBC makes it possible to do three things:

establish a connection with a database
send SQL statements
process the results
The mechanism to communicate with database servers exist as standard Java classes. This ensures that the security features of Java remain and that JDBC code integrates cleanly in Java code. The JDBC API is expressed through several abstract Java interf aces that allow to link to any number of databases. The interfaces are:

java.sql.DriverManager: handles the loading and unloading of the appropriate database drivers required to make the connection.
java.sql.Connection: exposes the database to the developer, representing the connection as an accessible Java component.
java.sql.Statement: provides a container for executing SQL statements using a connection.
java.sql.ResultSet: exposes the data that returns from the database server to the Java application.
Two models for database access are supported by the JDBC API. They are the two-tier model and the three-tier model. The last one is mentioned more generally as a multitier.

The two-tier model

In the two-tier model, a Java applet or application talks directly to the database. This requires a JDBC driver that can communicate with the particular database management system (DBMS) being accessed. SQL statements are delivered to the database, and the results are sent back to the user.
 This is referred to as a client/server configuration, in which the users machine is the client and the machine housing the database is the server. The database may be located on another machine to which the user is connected via a network.

1 Response to "JDBC connectivity"

  1. shanmuga says:
    26 January 2012 at 06:06

    wow what are fantastic website users are getting a knowledge to this site ok do well

Post a Comment

comments