Skip to content
  • Facebook
GeekCer Logo

GeekCer

The geek's Coding education and Review centre

  • Home
  • Tutorials
    • Java
    • Servlet
    • JSP
    • Python
    • C Tutorial
    • Spring
    • Spring Boot
    • MongoDB
    • Hibernate
    • Data Structure
  • General Knowledge
  • Biography
  • Grammar
  • Festival (त्योहार)
  • Interview
  • Differences
  • Important
  • Toggle search form

Home » Java » JDBC Driver in Java

  • Republic day गणतंत्र दिवस | Happy Republic Day
    Republic day गणतंत्र दिवस कब और क्यों मनाया जाता है? Festival
  • Structure in C program with example | Nested structure in C
    Structure in C program with example | Nested structure in C C Language
  • Python List
    Python List Python
  • Kapil Sharma Show, Comedy Show in Hindi
    Kapil Sharma Show, Comedy Show in Hindi Biography
  • Sawan ka Mahina : सावन का महीना का महत्व, भगवान शिव की पूजा
    Sawan ka Mahina : सावन का महीना का महत्व, भगवान शिव की पूजा Festival
  • Difference Between get() and load() in Hibernate with example
    Difference Between get() and load() in Hibernate with example Differences
  • Kishore Kumar Biography in Hindi | किशोर कुमार की जीवनी
    Kishore Kumar Biography in Hindi | किशोर कुमार की जीवनी Biography
  • Java Operators
    Java Operators Java

JDBC Driver in Java

Posted on August 27, 2021November 1, 2021 By admin No Comments on JDBC Driver in Java
JDBC Driver in Java

JDBC driver in Java is an API which is a set of classes and interfaces that helps the programmer to write programs for connection to database, retrieve data from database and perform many database related operations.

It is the essential feature for the project development which helps to communicate with any database through a java program. You can easily communicate with database even if you don’t know much about database commands, and if you are changing database then it will require few changes in java program.

And the most important thing about JDBC driver is that it provides better maintainability of the code on different platforms.

Full form of JDBC is Java Database Connectivity.

Each driver has its own advantages and disadvantages which we will discuss in this article.

Table of Contents

  • Types of JDBC driver in Java
    • 1. Type-1 driver or JDBC-ODBC bridge driver
      • Advantages of JDBC-ODBC bridge driver
      • Disadvantages of JDBC-ODBC bridge driver
    • 2. Type-2 driver or Native API driver
      • Advantages of Native API Driver
      • Disadvantages of Native API Driver
    • 3. Type-3 driver or Network protocol driver
      • Advantages of Network protocol driver
      • Disadvantages of Network protocol driver
    • 4. Type-4 driver or Pure java driver (Thin driver)
      • Advantages of Thin driver
      • Disadvantages of Thin driver
  • Why didn’t Sun adopt the ODBC model?
  • Ultimate goal of the JDBC

Types of JDBC driver in Java

There are four types of JDBC drivers which are as follows:

1. Type-1 driver or JDBC-ODBC bridge driver

This driver depends on the ODBC driver, it receives any JDBC calls and sends them to the ODBC driver, and then ODBC communicates with the database library when it understands it. In other words, to communicate with database it converts the JDBC calls to ODBC function calls.

Advantages of JDBC-ODBC bridge driver

  • It is database dependent driver.
  • Very easy to use.
  • It allows access to almost all the database.

Disadvantages of JDBC-ODBC bridge driver

  • Performance of this driver is not much good.
  • We need to install on client machine.

2. Type-2 driver or Native API driver

With the help of database library type-2 driver converts JDBC class into database specific calls, this driver communicates directly with the database server. It is directly understandable to the database.

So there must be some binary code in the client machine or that helps to communicate with the server.

Advantages of Native API Driver

  • It offers better performance than JDBC-ODBC bridge driver.
  • Type-2 does not require an ODBC driver.

Disadvantages of Native API Driver

  • It is vender specific driver.
  • You need to load library on each client machine.
  • You cannot use type-2 driver for the internet.
  • It is not a portable driver because it is not written in Java.

3. Type-3 driver or Network protocol driver

The type-3 driver is independent of database and it is pure java client library. It follows a three-tiered approach. It uses a middle-tier server, which translate the JDBC calls to database specific library and sends it to the database server. In other words, the request is passed through the network to server machine and then to database server.

Advantages of Network protocol driver

  • It is portable driver because it is written in java.
  • There is no requirement of vendor specific library.

Disadvantages of Network protocol driver

  • Client machine required network support.
  • We need to change middle tier code if we change the database.
  • Maintenance is very costly,

4. Type-4 driver or Pure java driver (Thin driver)

The Type 4 driver is a pure Java library that translates JDBC calls directly into database-specific DBMS protocols. It helps the client to communicate directly with database server.

Mostly, we use type-4 driver on the internet.

Advantages of Thin driver

  • It provides better performance than all other drivers.
  • It is portable because it is completely written in Java.
  • There is no need to install any library on the client system.

Disadvantages of Thin driver

  • The main disadvantage of this driver is that it is database dependent. We need database specific driver. For example, if we are using Oracle then we have to use Oracle driver, if we are using MySql database then we have to use MySql driver.

Why didn’t Sun adopt the ODBC model?

  • ODBC is hard to learn and it has some commands with lots of complex options.
  • ODBC relies on the use of void* pointers.
  • It uses C features that are not inherent in the Java programming language, so it can be difficult for Java programmers.
  • An ODBC-based solution is less safe and harder to deploy than a pure Java solution.

Ultimate goal of the JDBC

The JDBC specification actually allows you to pass any String for the built-in driver. The driver can pass any String to database.

Programmers can write applications in the Java programming language to access any database, using standard SQL as well as using extensions to SQL.

In conclusion, if you got the idea about the JDBC driver then your next step should be the java connectivity with database. Hope you liked the article of JDBC driver in Java. Feel free to contact on geekcer.code@gmail.com or you can write a comment if you have any doubt and query.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • More
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Also Read

Java

Post navigation

Previous Post: Exception Handling in Java
Next Post: Steps of Database Connectivity in Java

More Related Articles

Java Keywords Java Keywords Java
Immutable class in Java Immutable class in Java | How to create Immutable class in Java Important
Multithreading in java Multithreading in java Java
Difference between Interface and Abstract class Difference between Interface and Abstract class Differences
Steps of Database Connectivity in Java Steps of Database Connectivity in Java Java
Jenkins java | Installing Jenkins on Windows Jenkins java | Installing Jenkins on Windows Important

Related Posts

  • Java Keywords
    Java Keywords Java
  • Immutable class in Java
    Immutable class in Java | How to create Immutable class in Java Important
  • Multithreading in java
    Multithreading in java Java
  • Difference between Interface and Abstract class
    Difference between Interface and Abstract class Differences
  • Steps of Database Connectivity in Java
    Steps of Database Connectivity in Java Java
  • Jenkins java | Installing Jenkins on Windows
    Jenkins java | Installing Jenkins on Windows Important

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Java Home
  • Java Comments
  • Java Variables
  • Java Data Types
  • Java Keywords
  • Java Operators
  • Java If-else Statement
  • Java Switch
  • Java Loop
  • Java Arrays
  • Method Overloading in Java
  • Java OOP
  • Java Collections
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Multithreading in java
  • Thread Synchronization
  • Exception Handling
  • Java JDBC Driver
  • Java Database Connectivity steps
  • Lambda Expressions
  • Concurrent Collections

Recent Posts

  • Structured Vs Unstructured Data in Hindi | Key Difference
  • Jhansi Ki Rani Lakshmi Bai History, Story, Information in Hindi
  • Elon musk Hindi : एलन मस्क हिंदी में, Autobiography,  Net Worth
  • World Environment Day in Hindi : Objective, Importance, Theme
  • Thomas Edison Biography in Hindi – थॉमस एडिसन जीवनी
  • International Nurses Day in Hindi | नर्स दिवस क्यों मनाते हैं?
  • Fork/Join Framework in Java | RecursiveTask, RecursiveAction
  • DBMS in Hindi | DBMS क्या है? | DBMS की विशेषताएं और प्रकार
  • Republic day गणतंत्र दिवस | Happy Republic Day
    Republic day गणतंत्र दिवस कब और क्यों मनाया जाता है? Festival
  • Structure in C program with example | Nested structure in C
    Structure in C program with example | Nested structure in C C Language
  • Python List
    Python List Python
  • Kapil Sharma Show, Comedy Show in Hindi
    Kapil Sharma Show, Comedy Show in Hindi Biography
  • Sawan ka Mahina : सावन का महीना का महत्व, भगवान शिव की पूजा
    Sawan ka Mahina : सावन का महीना का महत्व, भगवान शिव की पूजा Festival
  • Difference Between get() and load() in Hibernate with example
    Difference Between get() and load() in Hibernate with example Differences
  • Kishore Kumar Biography in Hindi | किशोर कुमार की जीवनी
    Kishore Kumar Biography in Hindi | किशोर कुमार की जीवनी Biography
  • Java Operators
    Java Operators Java
  • Java Tutorial
  • Servlet Tutorial
  • JSP Tutorial
  • Maven Tutorial
  • HTML Tutorial
  • Programs
  • Hindi/English Grammar
  • Difference Between ... and ...
  • HR Interview
  • Important Articles

Write to Us:
geekcer.code@gmail.com

  • About Us
  • Privacy and Policy
  • Disclaimer
  • Contact Us
  • Sitemap

Copyright © GeekCer 2022 All Rights reserved