3: What is Driver? How many Drivers are available in JDBC? What are the types?
- It is a process of interacting with the database from a java application.
- In JDBC applications we must specify the complete database logic in java application as for the java API representations, later on, we need to send java represented database logic to the database engine(DBE).
- DBE must execute the database logic but it was configured as per the java representations but DBE able to understand only Query Language representations.
- At the above situation, if we want to execute our database logic, we need to use one interface in between java application and the database, that interface must convert java representations to query language representations and query language representations to java representations. Now this interface is called as a “Driver”.
Driver:
- It is a software or an interface existed in between a java application and database, which will map java API calls with query language API calls and vice versa.
- Initially, sun Microsystems has provided “driver interface” to the market with this sun Microsystems has given an intimation to all the database vendors to have their own implementation as per their requirements for the Driver interface.
- As a response, all the database vendors are providing their own implementation for the Driver interface in order to interact with the respective databases from a java application.
- The users of the respective databases they must get the respective database provided Driver implementation from the database software and make use as part of the JDBC applications to interact with the respective databases from a java application.
Types of Drivers:
There are 180+ number of Drivers in the market. But all these Drivers could be classified into the following 4 types.
There are 180+ number of Drivers in the market. But all these Drivers could be classified into the following 4 types.
- Type 1 Driver
- Type 2 Driver
- Type 3 Driver
- Type 4 Driver
Type 1 Driver:
- Type 1 Driver is also called as Jdbc-Odbc Driver or Bridge Driver.
- Jdbc-Odbc Driver is an implementation of Driver interface provided by the sun Microsystems along with the java software.
- Jdbc-Odbc Driver internally depends on the Microsoft product Odbc Driver.
- Odbc is nothing but open database connectivity. It is an open specification which can be used to interact with any type of databases.
Advantages:
- This Driver is already available with java software that’s why no need to bother about how to get the Driver implementation explicitly.
- Almost all the databases could support this Driver.
Disadvantages:
- This Driver internally depends on Odbc Driver that’s why it is not suitable for internet or web applications or network applications.
- This Driver is a slower Driver, why because Jdbc-Odbc Driver will convert java calls to Odbc calls. Then Odbc Driver has to convert Odbc calls to query language calls.
- This driver is not portable Driver why because it was not complete the java implementations in Jdbc-Odbc Driver.
- It we want to use Jdbc-Odbc Driver in our JDBC applications then we must require installing Odbc-Native Library.
Type 2 Driver:
Type 2 Driver is also called as “part java part native Driver”. i.e., this Driver was designed by using some part of the java implementations and some other part of the database vendor provided native implementations. This Driver is also called as “native driver”.
Advantages:
When compared to Type 1 driver it is efficient driver why because Type 2 driver directly will convert java API calls to database vendor API calls.
When compared to Type 1 driver it is efficient driver why because Type 2 driver directly will convert java API calls to database vendor API calls.
Disadvantages:
- If we want to use Type 2 Driver in our JDBC applications then we must require installing database vendor native API.
- It is a boastful Driver.
- It is not suitable for web applications, distributed applications, and web applications.
- Type 2 Driver performance is low when compared to Type 3 and Type 4 drivers.
- This driver is not a portable driver. Why because this driver was not designed completely in java technology.
Type 3 Driver:
- It is also called as middleware database access server driver.
- This driver could be used to interact with multiple databases from the multiple clients.
- This driver could be used in collaboration with the application server.
- This driver is suggestable for network applications.
Advantages:
- It is the fastest driver among all the drivers available in the market.
- To use Type 3 driver in our JDBC applications it is not required to install the JDBC native library and database native library.
- It is very much suitable for network applications.
Disadvantages:
- This driver is not suitable for simple JDBC applications.
- This driver requires minimum 3-Tier Architecture.
- When compared to Type1 and Type2 drivers. The type3 driver is efficient and portable. But when compared to a Type4 driver, the Type3 driver is not portable.
Type 4 Driver:
- This driver is also called as pure java driver i.e, this driver was completely implemented by using java technology.
- When compared to Type1, Type2, and Type3 drivers. A type4 driver is a portable driver.
- The type4 driver can be used for any kind of applications.
- The type4 driver is the cheapest driver when compared to all the drivers that're why it is frequently used the driver.
Comments
Post a Comment