Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Jdbc Understanding The Jdbc Architect

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

23 comments so far (post your own) View All Comments Latest 10 Comments:

JDBC is an API specification developed by Sun Microsystems that defines a uniform interface for accessing various relational databases. JDBC is a core part of the Java platform and is included in the standard JDK distribution.

The primary function of the JDBC API is to provide a means for the developer to issue SQL statements and process the results in a consistent, database-independent manner. JDBC provides rich, object-oriented access to databases by defining classes and interfaces that represent objects such as:

Database connections
SQL statements
Result Set
Database metadata
Prepared statements
Binary Large Objects (BLOBs)
Character Large Objects (CLOBs)
Callable statements
Database drivers
Driver manager
The JDBC API uses a Driver Manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The JDBC driver manager ensures that the correct driver is used to access each data source. The Driver Manager is capable of supporting multiple concurrent drivers connected to multiple heterogeneous databases. The location of the driver manager with respect to the JDBC drivers and the servlet is shown in Figure 1.

Layers of the JDBC Architecture



A JDBC driver translates standard JDBC calls into a network or database protocol or into a database library API call that facilitates communication with the database. This translation layer provides JDBC applications with database independence. If the back-end database changes, only the JDBC driver need be replaced with few code modifications required. There are four distinct types of JDBC drivers.

Type 1 JDBC-ODBC Bridge. Type 1 drivers act as a "bridge" between JDBC and another database connectivity mechanism such as ODBC. The JDBC- ODBC bridge provides JDBC access using most standard ODBC drivers. This driver is included in the Java 2 SDK within the sun.jdbc.odbc package. In this driver the java statements are converted to a jdbc statements. JDBC statements calls the ODBC by using the JDBC-ODBC Bridge. And finally the query is executed by the database. This driver has serious limitation for many applications. (See Figure 2.)

Type 1 JDBC Architecture



Type 2 Java to Native API. Type 2 drivers use the Java Native Interface (JNI) to make calls to a local database library API. This driver converts the JDBC calls into a database specific call for databases such as SQL, ORACLE etc. This driver communicates directly with the database server. It requires some native code to connect to the database. Type 2 drivers are usually faster than Type 1 drivers. Like Type 1 drivers, Type 2 drivers require native database client libraries to be installed and configured on the client machine. (See Figure 3.)

Type 2 JDBC Architecture



Posted by shan on Friday, 08.27.10 @ 16:52pm | #99213

yeah...........it's very useful to understanding terminalogy.......i prefer alwas ...roseindia.net
thanku ...

Posted by sureesh on Wednesday, 08.18.10 @ 13:15pm | #99016

these are excellent tutorials. but we want video tutorials also
good explanation.......

Posted by murali on Saturday, 07.24.10 @ 12:20pm | #98393

pls write notes in essay way

Posted by ravi on Sunday, 05.9.10 @ 17:08pm | #96923

link the form.....

Posted by Arun.N on Tuesday, 03.2.10 @ 16:39pm | #95227

thanks..for giving such a effective matter on jdbc.
in my openion the driver architectures was not sufficient...
thank you...

Posted by vijaykumar on Friday, 02.5.10 @ 10:23am | #94599

I realy can understand it . it is in easy language but i want to learn how to write programs so plz reply i will definately follow ur advice

Posted by Harsha v Tiwari on Wednesday, 08.26.09 @ 16:43pm | #90325

Send me some more Information of JDBC.B'cause I want to do a Project BAsed on This........

Posted by mithun kumar on Tuesday, 07.7.09 @ 11:32am | #89098

its good.more case study required for newer.

Posted by KAUSTUV on Sunday, 02.22.09 @ 00:40am | #85087

I got a excellent information from roseindia.net on JDBC...

Posted by praveen on Wednesday, 02.18.09 @ 00:51am | #84955

It is good to give more sample progarams and its output.

Posted by sachin gaikwad on Tuesday, 02.3.09 @ 03:20am | #84434

I visited this site and I really gain more and more details on java. All the discriptions are well and good. Thanks.

Posted by Balaji. B on Friday, 01.2.09 @ 00:01am | #83400

very helpful materail...its very clear and understandable...thanks a lot

Posted by rajesh on Thursday, 12.18.08 @ 07:02am | #82925

It is an Excellent medium to understand......

Posted by Rajesh on Sunday, 10.12.08 @ 01:59am | #81022

very good material.I learned a lot from your site

Posted by samba siva rao on Saturday, 04.5.08 @ 17:03pm | #55401

Understanding the JDBC Architecture


JDBC is an API specification developed by Sun Microsystems that defines a uniform interface for accessing various relational databases. JDBC is a core part of the Java platform and is included in the standard JDK distribution.

The primary function of the JDBC API is to provide a means for the developer to issue SQL statements and process the results in a consistent, database-independent manner. JDBC provides rich, object-oriented access to databases by defining classes and interfaces that represent objects such as:

Database connections
SQL statements
Result Set
Database metadata
Prepared statements
Binary Large Objects (BLOBs)
Character Large Objects (CLOBs)
Callable statements
Database drivers
Driver manager
The JDBC API uses a Driver Manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The JDBC driver manager ensures that the correct driver is used to access each data source. The Driver Manager is capable of supporting multiple concurrent drivers connected to multiple heterogeneous databases. The location of the driver manager with respect to the JDBC drivers and the servlet is shown in Figure 1.

Layers of the JDBC Architecture



A JDBC driver translates standard JDBC calls into a network or database protocol or into a database library API call that facilitates communication with the database. This translation layer provides JDBC applications with database independence. If the back-end database changes, only the JDBC driver need be replaced with few code modifications required. There are four distinct types of JDBC drivers.

Type 1 JDBC-ODBC Bridge. Type 1 drivers act as a "bridge" between JDBC and another database connectivity mechanism such as ODBC. The JDBC- ODBC bridge provides JDBC access using most standard ODBC drivers. This driver is included in the Java 2 SDK within the sun.jdbc.odbc package. In this driver the java statements are converted to a jdbc statements. JDBC statements calls the ODBC by using the JDBC-ODBC Bridge. And finally the query is executed by the database. This driver has serious limitation for many applications. (See Figure 2.)

Type 1 JDBC Architecture



Type 2 Java to Native API. Type 2 drivers use the Java Native Interface (JNI) to make calls to a local database library API. This driver converts the JDBC calls into a database specific call for databases such as SQL, ORACLE etc. This driver communicates directly with the database server. It requires some native code to connect to the database. Type 2 drivers are usually faster than Type 1 drivers. Like Type 1 drivers, Type 2 drivers require native database client libraries to be installed and configured on the client machine. (See Figure 3.)

Type 2 JDBC Architecture



Type 3 Java to Network Protocol Or All- Java Driver. Type 3 drivers are pure Java drivers that use a proprietary network protocol to communicate with JDBC middleware on the server. The middleware then translates the network protocol to database-specific function calls. Type 3 drivers are the most flexible JDBC solution because they do not require native database libraries on the client and can connect to many different databases on the back end. Type 3 drivers can be deployed over the Internet without client installation. (See Figure 4.)
Java-------> JDBC statements------> SQL statements ------> databases.

Type 3 JDBC Architecture



Type 4 Java to Database Protocol. Type 4 drivers are pure Java drivers that implement a proprietary database protocol (like Oracle's SQL*Net) to communicate directly with the database. Like Type 3 drivers, they do not require native database libraries and can be deployed over the Internet without client installation. One drawback to Type 4 drivers is that they are database specific. Unlike Type 3 drivers, if your back-end database changes, you may save to purchase and deploy a new Type 4 driver (some Type 4 drivers are available free of charge from the database manufacturer). However, because Type drivers communicate directly with the database engine rather than through middleware or a native library, they are usually the fastest JDBC drivers available. This driver directly converts the java statements to SQL statements.

(See Figure 5.)

Type 4 JDBC Architecture



So, you may be asking yourself, "Which is the right type of driver for your application?" Well, that depends on the requirements of your particular project. If you do not have the opportunity or inclination to install and configure software on each client, you can rule out Type 1 and Type 2 drivers.

However, if the cost of Type 3 or Type 4 drivers is prohibitive, Type 1 and type 2 drivers may become more attractive because they are usually available free of charge. Price aside, the debate will often boil down to whether to use Type 3 or Type 4 driver for a particular application. In this case, you may need to weigh the benefits of flexibility and interoperability against performance. Type 3 drivers offer your application the ability to transparently access different types of databases, while Type 4 drivers usually exhibit better performance and, like Type 1 and Type 2 drivers, may be available free if charge from the database manufacturer.


Posted by tpr on Monday, 03.31.08 @ 14:32pm | #54858

Many Thanks

Posted by Sachin Sasne on Thursday, 12.6.07 @ 16:05pm | #41439

i want to know the details about swings in order to do projects

Posted by balaji on Tuesday, 08.14.07 @ 10:16am | #23344

Nice article!! Looking for this kind of explanation for lond. The information provided int the site is much useful for me and my carrer.

Posted by S.Senthilraja.BE on Tuesday, 05.29.07 @ 19:55pm | #17670

it is a fantastic effort to give larger idea regarding JDBC.


I will be grate ful if kindly provide a full project with source code.

Posted by MD. BENHUR HASSAN on Sunday, 05.6.07 @ 11:22am | #15341

THanks for the detailed INFo.

Posted by Hrishikesha Narsha on Wednesday, 04.11.07 @ 14:43pm | #13863

Nice article!! Looking for this kind of explanation for long

Posted by Ranjan Chhibber on Sunday, 03.25.07 @ 23:08pm | #12681

The information provided in the site is much useful for me..
thanx

Posted by shanmugapriya on Tuesday, 03.13.07 @ 17:46pm | #11586

Ask programming questions?

 

 

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name

 

 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.