Académique Documents
Professionnel Documents
Culture Documents
Database connectivity refers to the connection between application software and database system. To
connect the database with an application, a framework is used to send and execute SQL statements from or
within the application code.
What is ODBC?
ODBC stands for Open Database Connectivity. It is a popular program interface for accessing relational
database. It is Microsoft’s API (Application Program Interface) which cannot be directly use with Java
because it uses C interface which is platform independent and insecure. So has defined its own API i.e.
JDBCAPI which uses JDBC driver written in Java Language.
What is JDBC?
It is an API (Application Programming Interface) which consists of a set of Java classes, Interfaces and
exceptions. It allows the programmer to connect Java application with the database and provide methods
for querying and updating into database. JDBC is a relational database orientation which mainly performs:
JDBC Drivers – It is a software component that enables Java application to interact with the database.
There are four types of JDBC Drivers:
1. JDBC-ODBC Bridge
It is known as Type-1 driver. This type of driver provides access to database through ODBC driver. It
converts JDBC call methods to ODBC call methods to connect to the database. The ODBC driver needs
to be installed on the client machine. The JDBC-ODBC Bridge that comes with JDK 1.2 is a good
example of this type of driver.
JDBC API
JAVA Vendor
JDBC-ODBC ODBC Driver
Application Database Database
Bridge Driver
Library
Client Machine
Advantages –
a. It is very easy to use.
b. It can be easily connected to any database
Disadvantage –
Its performance degraded because it converts JDBC method into the ODBC function call.
2. Native API Driver (Partially Java Driver)
It is known as Type-2 driver. In this type driver client side libraries are used to access database. These
libraries need to be installed on client machine and these libraries are database specific. This driver
converts JDBC method call into native calls of the database API. The Oracle OCI(Oracle Call Interface)
driver is an example of Type-2 driver.
JDBC API
JAVA Vendor
Native API
Application Database Database
Driver
Library
Client Machine
Advantage-
Its performance upgraded than JDBC-OI bridge driver.
Disadvantages –
a. The vendor client library needs to be installed on client machine.
b. The native driver needs to be installed on the each client machine.
3. Network Protocol Driver(Fully Java Driver)
It is also known as Type-3 driver. It uses middleware (application server) that converts JDBC calls
directly or indirectly into the vendor specific database protocol. All libraries are installed on a sever
and use to connect the database for accessing it. So network is required.
JDBC API
JAVA Network
Protocol Middleware
Application Database
Driver
Advantage –
No client side library is required.
Disadvantages –
a. It requires database specific coding to be done in the middle tier.
b. Network support is required on client machine.
4. Thin Driver (Fully Java Driver)
It is a Type-4 driver. It converts JDBC calls directly into vendor specific database protocol. It is pure java
driver whose methods call is not need to be convert to connect database or execute query. MYSQL’s
Connector/J is a Type-4 driver.
JDBC API
JAVA
Thin Driver
Application Database
Client Machine
Advantages-
a. There is no software required at client side or server side.
b. Better performance than all other drivers.
Disadvantage-
ODBC Stands for Open Database Connectivity. JDBC Stands for java database connectivity.
We can use ODBC for any language like C,C++,Java etc. We can use JDBC only for Java languages.
We can choose ODBC only windows platform. We can Use JDBC in any platform.
Mostly ODBC Driver developed in native languages like JDBC Stands for java database connectivity.
C,C++.
For Java applications it is not recommended to use For Java application it is highly recommended to
ODBC because performance will be down due to internal use JDBC because there we no performance &
Dependent.