Updates
  • Starting New Weekday Batch for Full Stack Java Development on 27 September 2025 @ 03:00 PM to 06:00 PM
  • Starting New Weekday Batch for MERN Stack Development on 29 September 2025 @ 04:00 PM to 06:00 PM

JDBC Driver

• JDBC Drivers is a client-side implementation that convert Java program request to Database Protocol which Database can understand.

• Types of JDBC Drives:

Type 1 Driver JDBC ODBC Bridge Driver.
Type 2 Driver Partial Java and Partial Native Driver.
Type 3 Driver Net Protocol Driver.
Type 4 Driver Pure Java Driver.

Type 1 Driver
Name JDBC ODBC Bridge Driver.
Vendor Java Vendor
Driver Class Sun.jdbc.odbc.jdbcOdbcDriver
URL Jdbc:odbc:<Data Source Name>
Username <Database Username>
Password <Database Password>
Software Required DB,java,ODBC Drivers

Architecture

A database driver implementation that uses the ODBC driver to connect to the database is the JDBC type 1 driver, commonly referred to as the JDBC-ODBC Bridge. Calls to JDBC methods are transformed into ODBC method calls by the driver.

Because the driver uses ODBC, which in turn depends on native libraries of the operating system the JVM is running on, it is platform-dependent. The use of this driver also results in additional installation requirements, such as the requirement that ODBC be installed on the machine where the driver is present and that the database accept ODBC drivers. If a pure-Java driver is an option, it is advised against using this driver. The use of a type 1 driver implies that any application is not portable.

Type 2 Driver
Name Partial native partial java Driver
Vendor DB Vendor
Driver Class Oracle.jdbc.driver.OracleDriver
URL Jdbc:oracle:oci8:@hostname:port:serviceName Ex: jdbc:oracle:oci8:@localhost:1521:XE
Username <Database Username>
Password <Database Password>
Software Required Database client Server Edition,Java

Architecture

The Partial Native Partial Java Driver, commonly known as the JDBC type 2 drivers, is an implementation of a database driver that makes use of the client-side libraries of the database. The driver transforms calls to JDBC methods into native API calls for the database. For instance: Type 2 drivers include Oracle OCI driver.

Type 3 Driver
Name Net Protocol
Vendor Java Vendor
Driver Class Com.ids.Driver
URL Jdbc:ids://hostname…
Username <Database Username>
Password <Database Password>
Software Required IDS Server, Database Client Server Edition,java

Architecture

The JDBC type 3 drivers, also known as the Net Protocol Driver for database middleware is a database driver implementation which makes use of a middle tier between the calling program and the database. The middle-tier (application server) converts JDBC calls directly or indirectly into a vendor-specific database protocol.

The same client-side JDBC driver may be used for multiple databases. It depends on the number of databases the middleware has been configured to support. The type 3 driver is platform-independent as the platform-related differences are taken care of by the middleware. Also, making use of the middleware provides additional advantages of security and firewall access.

Type 4 Driver
Name Pure Java Driver
Vendor Java Vendor
Username <Database Username>
Password <Database Password>
Software Required Database,Java

For Oracle Driver
Driver class Oracle.jdbc.driver.OracleDriver
Url Jdbc:oracle:thin:@<host>:<port>:<serviceName>
Ex: jdbc:oracle:thin:@localhost:1521:XE
Class Path Ojdbc14.jar
Ojdbc6.jar

For MySQL Driver
Driver class Com.mysql.jdbc.Driver
Url Jdbc:mysql://@<host>:<port>:<dbName>
Ex: jdbc:mysql://localhost:3306/jdbc
Class Path Mysql.jar

Architecture

A database driver implementation that transforms JDBC calls directly into a vendor-specific database protocol is the JDBC type 4 driver, also referred to as the Direct to Database Pure Java Driver.

Because type 4 drivers were entirely written in Java, they are platform neutral. They are installed within the client's Java virtual machine. Due to the lack of the overhead associated with converting calls into ODBC or database API calls, this performs better than the type 1 and type 2 drivers. It does not require any additional software to function, in contrast to type 3 drivers.

The JDBC client needs multiple drivers, which are often provided by the vendor, to connect to different types of databases because the database protocol is vendor-specific.

Pros and Cons of Types Of Drivers
Advantages Disadvantages
Type 1 Driver • Type 1 is very easy to use and maintain.
• Type 1 is suitable for migrating applications to Java without changing the existing ODBC setup.
• No extra software is required for the Type 1 implementation.
• The performance of Type 1 is acceptable.
• Driver implementation is possible in Windows only because ODBC drivers are available only with Windows.
• The performance of this driver is not excellent, but acceptable.
Type 2 Driver • Type 2 is faster than all other drivers. • In type 2, both client and server machines will have the database library.
• When the database is migrated, there will be a lot of maintenance because you need to re-install client-side libraries on all the client machines.
Type 3 Driver • In type 3, client-side DB libraries are moved to a middleware server called an IDS server.
• Because of this,client-side maintenance is reduced.
• You need to purchase extra software called IDS Server.
• Because you have a middleware server between your programme and the database server,performance will be reduced.
Type 4 Driver • This driver is the best among all the drivers and is highly recommended to use. • Negligible.