0% found this document useful (0 votes)
3 views7 pages

JDBC Overview and Driver Types

The document provides an overview of JDBC (Java Data Base Connectivity), which is a set of interfaces and classes for accessing databases through Java applications. It describes the four types of JDBC drivers—Bridge Driver, Native-API Driver, Network Protocol Driver, and Database Protocol Driver—along with their advantages and disadvantages. Additionally, it lists popular JDBC drivers for various databases and their corresponding connection URL formats.

Uploaded by

margabira164
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

JDBC Overview and Driver Types

The document provides an overview of JDBC (Java Data Base Connectivity), which is a set of interfaces and classes for accessing databases through Java applications. It describes the four types of JDBC drivers—Bridge Driver, Native-API Driver, Network Protocol Driver, and Database Protocol Driver—along with their advantages and disadvantages. Additionally, it lists popular JDBC drivers for various databases and their corresponding connection URL formats.

Uploaded by

margabira164
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Ch 7 java

Database connectivity
Overview of JDBC
· JDBC (Java Data Base Connectivity) is a complete set of interfaces and
classes that allows access to an underlying database through java
application.

JDBC = JDBC API + JDBC Driver

· The API defines the interfaces and methods vendors implement when
writing a JDBC driver.

· JDBC drivers implement the defined interfaces in the JDBC API for
interacting with Df database.

· A single JDBC driver does not enable you to access different “brands” of
[Link] o

JDBC Model

JDBC Driver Types

Type Description

1 Bridge Driver (JDBC-to-ODBC) – connect


a Microsoft ODBC (Open Database Conn
data source.

2 Native-API Driver –is a database


implementation that uses the client-side lib
the database. The driver converts JDBC met
into native calls of the database API.

3 Network Protocol Driver (Middleware D


The requests are sent to an application serve
translates the database requests into a d
specific protocol.

4 Database Protocol Driver (Pure Java


– convert JDBC requests to database-specific
protocols at the client side, so that Java prog
connect directly to a database.
Type 1:

Advantages

• Almost any database for which an ODBC driver is installed can be


accessed, and data can be retrieved.

Disadvantages

• Performance overhead

• The ODBC driver needs to be installed on the client machine.


• Not suitable for applets, because the ODBC driver needs to be
installed on the client.

Type 2:

Advantages

• As there is no implementation of jdbc-odbc bridge, its


considerably faster than a type 1 driver.

Disadvantages

• The vendor client library needs to be installed on the client


machine.

• Not all databases have a client side library.

• This driver is platform dependent

• This driver supports all java applications except Applets


Type 3:

Advantages

· Since the communication between client and the middleware server is


database independent, there is no need for the database vendor library on
the client. The client need not be changed for a new database.

Disadvantages

• Requires database-specific coding to be done in the middle tier.

• The middleware layer added may result in additional latency, but is


typically overcome by using better middleware services.
Type 4:

Advantages

• No translation or middleware layers are used, improving


performance.

• The JVM can manage all aspects of the application-to-database


connection; this can facilitate debugging.

Disadvantages

· Drivers are database dependent, as different database vendors use widely


different (and usually proprietary) network protocols.
Some Popular JDBC Drivers

RDB JDBC Driver Name


MS
MyS Driver Name : [Link]
QL Database URL format:
jdbc:mysql//hostname/
databaseName
Orac Driver
le Name : [Link]
Database URL format:
jdbc:oracle:thin@hostname:portnumb
er:databaseName
DB2 Driver
Name : [Link].DB2Drive
r
Database URL format:
jdbc:db2:hostname:portnumber/
databaseName
Acce Driver
ss Name : [Link]
Database URL format:
jdbc:odbc:databaseName
Java Driver
DB Name : [Link]
Database URL format:
jdbc:derby:databaseName

You might also like