Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

JDBC – Type 2 Driver

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

A JDBC driver enables Java application to interact with a database from where we can fetch or store data. JDBC drivers are analogous to ODBC drivers. The JDBC classes are contained in the Java Package java.sql and javax.sql.JDBC helps to

  • Connect to a data source, like a database.
  • Send queries and update statements to the database
  • Retrieve and process the results received from the database in answer to your query

The Java.sql package that ships with JDK contain various classes with their behaviors defined and their actual implementations are done in third-party drivers. Third-party vendors implement the java.sql.Driver interface in their database driver.

  • JDBC driver types are used to categorize the technology used to connect to the database.
  • Type -1 Bridge driver
  • Type -2 Native API
  • Type -3 Network Protocol
  • Type -4 Native Protocol

Type 2 or Partial Java driver: Also known as Native API converts JDBC calls into database-specific native libraries calls and these calls are directly understood by the database engine. This type of driver converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, DB2, or other DBMS.

Note that, like the bridge driver or Type-1 driver, Also this driver requires some binary code to be loaded on each client machine.

  • JDBC driver directly talks to DB client using native API
  • It required native API to connect to DB client it is also less portable and platform dependent
  • Type 2 drivers convert JDBC calls into database-specific calls i.e. this driver is specific to a particular database.
  • Like Type 1 drivers, it’s not written in Java Language which forms a portability issue.
  • If we change the Database we have to change the native API as it is specific to a database.
  • It is not threaded Safe
  • No longer produced or used.
  • Type-2 Drivers aren’t architecturally compatible

This type of driver converts the calls that a developer writes to the JDBC application programming interface into calls that connect to the client machine’s application programming interface for a specific database, such as IBM, Informix, Oracle or Sybase.

My Personal Notes arrow_drop_up
Last Updated : 11 Feb, 2021
Like Article
Save Article
Similar Reads
Related Tutorials