What is type2 driver of JDBC what are the advantages and disadvantages of it?

This driver is known as a native API driver. This driver receives the calls from Java application and converts them in to vender specific native API calls. Here, we need to install The vendor-specific driver on the client machines.

If we change the Database, we have to change the native API, as it is specific to a database and they are mostly obsolete now, but you may realize some speed increase with a Type 2 driver because it eliminates ODBC's overhead.

Advantages of type2 driver

Following are the advantages of the type2 driver.

  • This type of driver fastest among all the 4 types of drivers.

  • If we use this driver, we can also access the features provided by the database vendor.

Disadvantages of type2 driver

Following are the disadvantages of a type2 driver.

  • On the client machine, the Java Application calls are converted into vendor-specific database calls. Therefore, we must install native libraries on the client machine.

  • Since the native functions are executed on the client machine a small error in their execution can cause severe damage.

  • This driver causes more cost.