Skip to main content

Java Database connectivity (JDBC)

Before starting to learn JAVA DATABASE CONNECTIVITY, We must ask "What is an API?"

What is an API?

API stands for application programming interface. Think of API as the interface between the device and the service requested.

In order to understand what an API is let us consider a real time example:

Suppose you are in a restraint and you have the menu with you .Now you have selected your item and you want to order it. How will you do this? There is an option of going directly into the kitchen and asking them to prepare your meal.

I am sure that no one would go for this method. The second option available for us is to call the waiter in the restaurant and order your item. The waiter then contacts the kitchen and asks them to prepare your order. So, you need someone who can collect your request and make the job done. You need a mediator to communicate.

Similar to the waiter in the restaurant ,an API acts as an interface between your device and the requested service.

What does API contain?

API consists of all the classes and methods which are required to communicate to the service and accomplish its task.

Formally speaking, In computer programming an API is a set of subroutine definitions, protocols and tools for building software and applications. API make the  life of a developer easy. Since it contains all the interfaces and classes , it makes easier for a developer to build applications in no time.

We already know that graphical user interface is required to interact with an application. Similarly an API acts as an interface between the developer and a specific technology which the developer/programmer wants to use in his application or software.

Introduction to JDBC :

JDBC stands for java database connectivity. JDBC is an API which helps in connecting and executing queries in the database.

JDBC API uses JDBC drivers to connect with the database.

JDBC API is written in java programming language.

Before JDBC:

Before JDBC API was invented, we were using ODBC (open database connectivity) which was written entirely in C language which was platform dependent and unsecured. So java created JDBC API in order to connect with the database.  

So far we have learnt what an API is and what is JDBC. Now let us learn what is JDBC driver.

We all know that JDBC API uses JDBC driver to connect with the database. JDBC driver is a software component which enables java to interact with the database.

There are 4 types of JDBC drivers :

  • .      JDBC-ODBC driver
  •        Native API driver
  • .  h    Network protocol driver
  •        Thin driver

1.    JDBC-ODBC driver:

JDBC-ODBC driver uses ODBC driver to connect to the database. The JDBC-ODBC bridge driver converts JDBC method calls into ODBC function calls. This is not encouraged at present because of the invention of the “thin driver”.


1. It is easy to use.
2. There is not a lot of connection specific code. It can be connected to any database.

Disadvantages of JDBC-ODBC driver:

1. Since there is a conversion involved in JDBC to ODBC calls, the performance is degraded.

2. The major disadvantage of using JDBC-ODBC driver is that it was compulsory that the ODBC driver must be installed in the user devices inorder to interact with the database.


This is partially written in java. It uses the client side libraries of the database. The driver converts the JDBC calls into the native calls of the database API.


1. Upgradation from the JDBC bridge driver into database specific API.

Disadvantage :

1. The driver must be installed on every device.
2. The database specific library must be present on the client system.

3.    Network Protocol driver:

This driver uses an intermediate application server which coverts the JDBC  calls into driver specific calls.

This is mostly written in java.


1. The major advantage of the Network protocol driver is that it does not require that the library must be installed on the client device.


1. Network support is required.
2. Overhead of maintaining the server.
3. Implementation is costly.

4.    Thin Driver:

The thin driver directly coverts JDBC calls into database specific calls. Hence it is known as the thin driver.
Thin driver is fully written in java.


1. Better performance when compared to all the other drivers.
2. No need of any server.


 1. The driver depends upon the specific datbase.


Popular posts from this blog

What’s the difference between AngularJS, Angular2 and Angular4?

One question that often comes out is “What is the basic difference between AngularJS, Angular 2 and Angular 4 and how to jump from Angular 2 to Angular 4?”

Angular JS was introduced in 2010 as a JavaScript framework for building client side single page web applications. So it gained popularity and the Angular team at google started to add some more features to the core. But the framework was not designed with the needs of today’s applications in mind and moreover it was totally complex. So the Angular team decided to rewrite the entire framework using TYPESCRIPT and as a result Angular 2 was released in mid 2016. The new Angular framework is completely different from the previous version and we can think of it as a completely different framework compared to the earlier one.

The decision was frustrating to most of the developers since a lot of applications have been designed using AngularJS. I personally liked the direction that Angular developers took in rewriting the entire framework a…


Angular JS is an open source framework built on JavaScript. It was built by the
developers at Google. This framework was used to overcome obstacles encountered while
working with Single Page applications. Also, testing was considered as a key aspect while
building the framework. It was ensured that the framework could be easily tested. The
initial release of the framework was in October 2010.

Features of Angular 2:Components: The earlier version of Angular had a focus of Controllers but now has changed the focus to having components over controllers. Components help to
build the applications into many modules. This helps in better maintaining the
application over a period of time.

TypeScript: The newer version of Angular is based on TypeScript. This is a
superset of JavaScript and is maintained by Microsoft.

Services: Services are a set of code that can be shared by different components
of an application. So for example, if you had a data component that picked data
from a database, you …