3. JDBC provides API or PROTOCOL to interact
with different DATABASE
With the help of JDBC drivers we can
connect with different database.
A JDBC driver works as interface between
client and Database server
4. Concepts of JDBC:
Open a connection between the DBMS & J2ME
application
Translate low-level SQL statements sent by J2ME
application into messages that sent by the J2ME
application.
Return data that conforms to the JDBC specification
to the JDBC drivers.
Return information, such as error messages that
conforms to the JDBC specification to the JDBC
drivers.
Provide transaction management routines that
confirms to the JDBC specification.
Close the connection between the DBMS & J2ME
application
5. Java Application
JDBC API
Data Base Drivers
Access SQL
Server
DB2 Informix MySQL Sybase
6. Type 1
JDBC-ODBC Bridge
Type 2
Native API, partially java
Type 3
JDBC Network Driver, partially java
Type 4
100% Java
7. Type 1 JDBC to ODBC Driver
the JDBC to ODBC Driver, also called the
JDBCODBC bridge, is used to translate DBMS
calls between JDBC specification & the ODBC
specifications.
The JDBC to ODBC driver receives message from
a J2ME application.
it is platform dependent.
Client JDBC-ODBC
ODBC DB
Vendor
Library
8. Type 2 Java/Native Code Driver
The Java/Native Code Driver uses the Java Classes to
generate platform specific code.
This code is only understood by a specific DBMS.
The disadvantage of this driver is lack of portability.
The API classes of Java/Native Code Driver probably
won’t work for another DBMS.
Client JDBC
Vendor
Library
DB
9. Type 3 JDBC Driver
Type 3 JDBC Driver is also referred as
JAVA protocol, is the most commonly used
driver
It converts SQL queries into JDBC
statements and translates JDBC formatted
statements into DBMS format.
3-TIER ARCHITECTURE
10. Type 4 JDBC Driver
Type 4 JDBC Driver is also referred as JAVA
Database Protocol, it is similar to Type 3 JDBC
Driver.
SQL queries are need not to convert into JDBC-format,
Directly translated into format
required by DBMS.
This is the fastest way to communicate SQL
queries to the DBMS.
It is 100% pure JDBC driver.
11. The JDBC API contained in two packages.
The first package is called Java.sql and contains core
JDBC interfaces of JDBC API.
It provide the basics for connecting to the DBMS and
interacting with data stored in the DBMS.
Java.sql is part of J2SE.
The second package is called Javax.sql, which extends
the Java.sql and is the part of J2ME.
It includes JDBC interface that interfaces with Java
Naming and Directory Interface(JNDI).
JDBC interface that manages connection pooling, among
other advanced JDBC features.