JDBC Driver types and their relative speed

Type 1:

These drivers act as a bridge between JDBC and ODBC connectivity mechanisms. They require ODBC drivers be installed on the client and are usually used on Microsoft platforms but are not recommended for production purposes. Here the jdbc is a thin layer which invokes the native ODBC database connectivity layer. These drivers are limited by the functionality of the ODBC driver and don’t support the complete Java set.

Type 2:

Java to Native API Drivers:
These drivers have a thicker JDBC layer and don’t need the ODBC driver be installed, but may still require a native Database specific connectivity mechanism be present, such as one for Oracle. Type 2 drivers are used to convert JDBC calls into native calls of the major database vendor APIs and are hence platform dependent. They are faster than type 1 drivers as they are partly Java drivers.

Type 3:

Net-protocol/ All-Java Driver
Type 3 JDBC drivers are pure Java drivers for database middleware. JDBC calls are translated into a middleware vendor’s protocol, and the middleware converts those calls into a database’s API. These are the most flexible type of drivers since they do not require native database libraries and can be deployed over the Internet without involving any client installation. Developers can also use a single JDBC driver to connect to multiple databases.

Type 4:

Native-protocol/all-Java Driver
The Driver is completely Java and hence does not involve any native code. Like Type 4 Drivers they do not require native database libraries and can be deployed over the Internet without involving any client installation. Type 4 drivers are however database specific. Because Type drivers communicate directly with the database engine rather than through middleware or a native library, they are usually the fastest JDBC drivers available.

About cuppajavamattiz
Matty Jacob - Avid technical blogger with interests in J2EE, Web Application Servers, Web frameworks, Open source libraries, Relational Databases, Web Services, Source control repositories, ETL, IDE Tools and related technologies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: