Docsity

JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the, Slides of Database Programming

Partial preview of the text

Download JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the and more Slides Database Programming in PDF only on Docsity!

Presentation by:

peakabo

JDBC

Java Data Base Connectivity

JDBC SERVER

It is independent of O.S. which is specific to JRE.

JDBC is an API with set of classes and interfaces

present in package java.sql

JAVA APP

DB

JDBC JRE DRIVER C L I E N T JAVA APP

DB

DRIVER SERVER JDBC JRE C L I E N T

JDBC API Application JDBC Driver A JDBC Driver Manager JDBC.ODBC BRIDGE ODBC JDBC Architecture JDBC Driver B DB DB DB

JDBC-ODBC Bridge Driver *A JDBC-ODBC bridge provides JDBC API access via one or more ODBC drivers. *Some ODBC native code and in many cases native database client code must be loaded on each client machine that uses this type of driver. *Type 1 drivers are "bridge" drivers. They use another technology such as Open Database Connectivity (ODBC) to communicate with a database. This is an advantage because ODBC drivers exist for many Relational Database Management System (RDBMS) platforms. The Java Native Interface (JNI) is used to call ODBC functions from the JDBC driver.

JDBC-ODBC Bridge Driver

JAVA

APP

DB JDBC-ODBC BRIDGE J D B C O D B C

C L I E N T

SERVER

  • (^) Advantages:

Almost any database for which ODBC driver is

installed, can be accessed.

Disadvantages:

  • (^) Performance overhead since the calls have to

go through the JDBC overhead bridge to the

ODBC driver, then to the native database

connectivity interface.

  • (^) The ODBC driver needs to be installed on the

client machine.

  • (^) Considering the client-side software needed,

this might not be suitable for applets.

  • (^) Advantage

Better performance than Type 1 since no

jdbc to odbc translation is needed.

Disadvantages

  • (^) The vendor client library needs to be

installed on the client machine.

  • (^) Cannot be used in internet due the client

side software needed.

  • (^) Not all databases give the client side library.

Native-API Partly Java Driver

ORA

CLE

SQL

Server OCI DB Library J D B C JAVA App C L I E N T SERVER

Functions:

  • (^) This type of driver converts JDBC calls into calls to the client API for that database.
  • (^) Client -> JDBC Driver -> Vendor Client DB Library -> Database

Net-Protocol Fully Java Driver JDBC Driver 1 Middle ware Appli cation

ODBC

OCI

DB

Library JAVA App JAVA App JDBC Driver 2

DB

Ora cle SQL Ser

CLIENT SERVER

APPLICATION SERVER Protocol 1 Protocol 2

Functions

  • (^) Follows a three tier communication approach.
  • (^) Can interface to multiple databases - Not vendor specific.
  • (^) The JDBC Client driver written in java, communicates with a middleware-net-server using a database independent protocol, and then this net server translates this request into database commands for that database.
  • (^) Thus the client driver to middleware communication is database independent.
  • (^) Client -> JDBC Driver -> Middleware-Net Server -> Any Database.
  • (^) Disadvantages
  • (^) Requires database-specific coding to be done in the middle tier.
  • (^) An extra layer added may result in a time-bottleneck. But typically this is overcome by providing efficient middleware
  • (^) This driver converts JDBC calls into the

network protocol used by DBMSs directly.

  • (^) This allows a direct call from the client to

the DBMS server and is a practical solution

for Intranet access.

  • (^) As protocols are proprietary to database

vendors, they will be the primary source

for this style of driver.

  • (^) Several database vendors have these in

progress.

Native-Protocol Fully Java Driver