Wednesday 19 July 2017

What are types of jdbc drivers?

                    In this post, we will see different types of jdbc drivers, JDBC Driver Types in Java | Database Driver Types | Types of Database Drivers | JDBC Drivers in Java | jdbc driver types in java,database driver types,types of database drivers,jdbc drivers,jdbc drivers in java,jdbc driver for mysql,jdbc driver types

Watch this video to know JDBC Driver Types in Java:


Watch on YouTube: https://www.youtube.com/watch?v=QfcfWnBUWK4

                    A jdbc driver is a connecting bridge between Java application and Database. It implements the jdbc interfaces targeting a specific Database.




                    There are four types of jdbc drivers as follows:

Type 1 Driver: JDBC-ODBC bridge driver

Type 2 Driver: Native-API driver

Type 3 Driver: Network-Protocol driver (Middleware driver)

Type 4 Driver: Database-Protocol driver (Pure Java driver)


Type 1 Driver: JDBC-ODBC bridge driver
                      ODBC stands for Open DataBase Connectivity. It is an open source driver. ODBC can be implemented for any database as it open source.
                       Java application requires JDBC-ODBC bridge driver to connect with ODBC driver which in turn connects with Database. 
e.g. Java application -> JDBC-ODBC bridge driver -> ODBC driver -> ODBC driver for mysql database -> mysql database
                       
                      Performance with this driver is not efficient as it has many sub-levels. Because of this, it is not used for real life applications.
                      But it is simple to use, that's why, it is used for testing purpose.
Type 1 Driver: JDBC-ODBC bridge driver

Type 2 Driver: Native-API driver
                      This driver maps the JDBC call to the Database call. As it is implemented only for few Databases, its use is limited.

                      It is mostly used in situation where Type 3 or Type 4 drivers are not available.
e.g. Oracle OCI Driver
Type 2 Driver: Native-API driver

Type 3 Driver: Network-Protocol driver (Middleware driver)    
                     This driver is installed at middleware server. Java application has to connect with Middleware server which in turn connect with database. 

Java Application -> Middleware Server -> Database                    

                      The advantage of this driver is that Java Application doesn't need to worry about the database. Middleware takes care of the connection with database. Because of this, Type 3 driver is used in cases where multiple databases are used.

                       Middleware server needs Type 1, Type 2 or Type 4 driver to connect with database.                    
Type 3 Driver: Network-Protocol driver (Middleware driver)
                     
Type 4 Driver: Database-Protocol driver (Pure Java driver)
                       This driver consists of Java code. It consists of libraries which is particular to the database which helps to connect with database.

e.g. Java application -> Pure Java Driver for mysql database -> mysql database
Type 4 Driver: Database-Protocol driver (Pure Java driver)

                       We need to download jar file for particular database which consists of the driver.

                        This is commonly used jdbc driver.





                   

No comments:

Post a Comment