What Is JDBC Drivers and Its Types?
JDBC driver implement the described interfaces in the JDBC API, for interacting with your databases server.
For example, using JDBC driver enable you to open databases connections and to interact with it by sending SQL or databases instructions then receiving results with Java.
The Java.sql package that ships with JDK, contains various classes with their behaviours described and their actual implementaions are done in third-party driver. 3rd celebration providers implements the java.sql.Driver interface in their databases driver.
JDBC Drivers Types
JDBC driver implementations vary because of the wide range of operating-system and hardware platforms in which Java operates. Sun has divided the implementation kinds into four categories, Types 1, 2, 3, and 4, which is explained below −
Type 1: JDBC-ODBC Link Driver
In a Type 1 driver, a JDBC bridge is used to accessibility ODBC driver set up on each customer device. Using ODBC, needs configuring on your system a Data Source Name (DSN) that represents the target databases.
When Java first came out, this was a useful driver because most databases only supported ODBC accessibility but now this type of driver is recommended only for trial use or when no other alternative is available.
Type 2: JDBC-Native API
In a Type 2 driver, JDBC API phone calls are converted into local C/C++ API phone calls, which are unique to the databases. These driver are typically offered by the databases providers and used in the same manner as the JDBC-ODBC Link. The vendor-specific driver must be set up on each customer device.
If we modify the Database, we have to modify the local API, as it is particular to a databases and they are mostly obsolete now, but you may realize some speed increase with a Type 2 driver, because it eliminates ODBC’s overhead.
Type 3: JDBC-Net genuine Java
In a Type 3 driver, a three-tier approach is used to accessibility databases. The JDBC clients use standard network sockets to connect with a middleware program server. The outlet information is then converted by the middleware program server into the call format required by the DBMS, and forwarded to the databases server.
This type of driver is incredibly versatile, since it entails no code set up on the customer and a single driver can actually provide accessibility multiple databases.
You can think of the program server as a JDBC “proxy,” meaning that it makes demands the customer program. As a result, you need some knowledge of the program server’s configuration in order to effectively use this driver type.
Your program server might use a Type 1, 2, or 4 driver to connect with the databases, understanding the nuances will prove helpful.
Type 4: 100% Pure Java
In a Type 4 driver, a genuine Java-based driver communicates directly with the retailer’s databases through outlet connection. This is the highest performance driver available for the databases and is usually offered by owner itself.
This type of driver is incredibly versatile, you don’t need to install special software on the customer or server. Further, these driver can be downloaded dynamically.
Which driver should be Used?
If you are obtaining one kind of data base, such as Oracle, Sybase, or IBM, the recommended driver kind is 4.
If your Java program is obtaining several kinds of data source simultaneously, type 3 is the recommended driver.
Type 2 driver are useful in circumstances, where a kind 3 or kind 4 driver is not available yet for your data source.
The type 1 driver is not regarded a deployment-level driver, and is commonly used for growth and examining reasons only. You can join the best oracle training or oracle dba certification to make your oracle careers.