Skip to main content

Types of JDBC Drivers

There are 4 types of drivers are present in JDBC. Each driver will have their advantages as well as disadvantages. Lets take a look into all drivers.

Type 1: JDBC-ODBC driver:
This driver receieves all JDBC calls and sends to ODBC ( Open Database Connectivity). ODBC driver understands these calls and communicates with the database library provided by the vendor. So, the ODBC driver, and the vendor database library must be present on the client machine.

Advantages: The JDBC-ODBC Bridge allows access to almost any database, since databases ODBC drivers are already available on the client machine.

Disadvantages: The performance of this driver is poor, since the JDBC call goes through the bridge to the ODBC driver, then to the native database connectivity library. The result comes back through the reverse process.


Type 2: Native API-partly Java driver:
It converts JDBC calls into database specific calls with the help of vendor database library. The type2 driver communicates directly with the database server. It requires that some binary code be present on the client machine.

Advantages: Type 2 driver typically offers better performance than the JDBC-ODBC Bridge.

Disadvantages: The vendor database library needs to be loaded on each client machine. This is the reason, type 2 drivers can not be used for the Internet. Type 2 driver shows lower performance than the type 3 and type4 drivers.


Type 3: Net Protocol – pure Java driver:
It follows three tier architecture where JDBC requests are passed through the network to a middle-tier (Net) server. The middle-tier translates the requests to the database specific library and then sends it to the database server. The database server then executes the request and gives back the results.

Advantages: This driver is Server-based, so there is no need for any vendor database library to be present on the client machine.

Disadvantages: Type 3 driver requires database specific coding to be done in the middle tier. Maintenance of the middle-tier becomes costly.


Type 4: Native protocol – pure Java driver:
This driver converts JDBC calls into the vendor-specific database management system (DBMS) protocol. So, that client applications can communicate directly with the database server. Level 4 driver completely implemented in java to achieve platform independence and eliminate deployment administration issues. Generally type 4 drivers are used on Internet.

Advantages: This driver has better performance than type 1 and type 2. Also, there is no need to install any special software on the client or server.

Disadvantages: With type 4 driver, the user needs a different driver for each database. For example, we need to communicate with Oracle server we need Oracle driver and to communicate with Sybase server, we need Sybase driver.

Related Posts:

Comments

Popular posts from this blog

Multithreading in java with example

Multithreading  is one of the most important concept in core java. In this article we will learn what is multithreading? , what is the use of it? and What is the use of Synchronization and when to use it?  with detailed examples. At a time, two or more threads are accessing the same object is called as Multithreading  in Java .  First, we will create two threads for two objects. It is also possible to run two or more threads on a single class object. In this case, there is a possibility to get unreliable results. If the two threads are perform same task, then they need same object to be executed each time. For your better understanding, take an example of any reservations like, railway, movie ticket booking,etc. Let us think only one berth is available in a train and two passengers are asking for that berth. The first person has sent a request to allocate that ticket/berth to him. At the same time, the second person also sent a request to allocate that ...

JNDI configuration for Tomcat 9 with Oracle

In this article, I am going to place the required source code to get data from the table by using the JNDI configuration. Below are the environment details that I have configured currently. Windows - 7 Oracle - 10g Tomcat - 9 JDK - 8 Eclipse Oxygen Ojdbc6 jar required First, we need to create the Dynamic Web Project. If you don't know how to do <Click Here>. I have faced a lot of issues before getting the output like 405, No driver class to load, etc. I am using JSP & Servlets in the current explanation. Before started writing the application logic, we need to do the below configuration in the installed tomcat directory. Place OJDBC6.jar in the Tomcat LIB directory. Add this Resource under <GlobalNamingResources> in Server.xml file which is present under the conf directory in Tomcat. < Resource name = "jdbc/myoracle" global= "jdbc/myoracle" auth = "Container" type= "javax.sql.DataSource" driverClass...

Git installation for AngularJS 2 in Windows 10

Download Git latest version from https://git-scm.com/downloads or you click on the below link to download directly for windows https://git-scm.com/download/win . Once download completes, click on executable file to start installation process and choose Yes to allow the software installation in windows 10. Click on Next button to continue further installation. Browse the isntallation directory and click on Next button to continue. Select the list of components which you want to be installed and click on Next button to proced further installation. Type the shortcut name for Start menu and click on Next button. Select how you want to use the Git and click on Next button. For Windows no need to change anything, let it be the default one. Choose the Use the OpenSSL library and click on Next button. Select how should Git treat line ending in text files and click on Next button. Select which terminal emulator to use with Git and click on Next button. Configure extr...