Type 4 Driver
In this tutorial, we are going to discuss about the Type 4 Driver in JDBC. Type 4 driver also known as Pure Java Driver OR Thin Driver.
This Driver is developed to talk with the Database directly without taking Support of ODBC Driver OR Vendor Specific Native Libraries OR Middleware Server. This Driver uses Database specific Native Protocols to communicate with the Database. This Driver converts JDBC Calls directly into Database specific Calls.
This Driver developed only in Java and hence it is also known as Pure Java Driver. Because of this, Type 4 Driver is Platform Independent Driver. This Driver won’t require any Native Libraries at Client side and hence it is light weighted. Because of this it is treated as Thin Driver.
Advantages
- It won’t require any Native Libraries, ODBC Driver OR Middleware Server
- It is Platform Independent Driver
- It uses Database Vendor specific Native Protocol and hence Security is more.
Limitation
The only Limitation of this Driver is, it is Database Dependent Driver because it is communicating with the Database directly.
Note
It is highly recommended to use Type 4 Driver.
Java Application âž” Type-1 Driver âž” ODBC Driver âž” DB
Java Application âž” Type-2 Driver âž” Vendor Specific Native Libraries âž” DB
Java Application âž” Type-3 Driver âž” Middleware Server âž” DB
Java Application âž” Type-4 Driver âž” DB
Which Driver should be used?
- If we are using only one Type of Database in our Application then it is recommended to use Type 4 Driver.
- If we are using multiple Databases in our Application then Type 3 Driver is recommended to use.
- If Type-3 and Type-4 Drivers are not available then only we should go for Type 2 Driver.
- If no other Driver is available then only we should go for Type 1 Driver.
That’s all about the Type 4 Driver in JDBC. If you have any queries or feedback, please write us email at contact@waytoeasylearn.com. Enjoy learning, Enjoy Java.!!