JDBC - Type 3 Driver

Last Updated : 23 Mar, 2026

Type -3 Driver JDBC is also known as Network Protocol Driver as it uses an application server that converts JDBC calls directly or indirectly into the vendor-specific database protocol. This driver translates JDBC calls into the middleware vendor’s protocol, which is then converted to a database-specific protocol by the middleware server software that provides connectivity to many databases.

  • Uses middleware (application server)
  • No native libraries required on client
  • Supports multiple databases with a single driver

Architecture

Middleware is software that acts as a bridge between the operating system and applications, enabling communication and data exchange. It works as a translation layer for distributed systems to interact efficiently.

Working of Type 3Driver

  • Java application sends request using JDBC API
  • Type 3 driver converts JDBC calls into middleware protocol
  • Middleware server translates it into database-specific protocol
  • Database processes the request
  • Response is sent back through middleware to the application

Example

Java
import java.sql.*;

public class Type3Example {
    public static void main(String[] args) {
        try {
            // Load driver
            Class.forName("com.middleware.jdbc.Driver");

            // Establish connection
            Connection con = DriverManager.getConnection(
                "jdbc:middleware://localhost:8080/mydb", "user", "password");

            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM students");

            while (rs.next()) {
                System.out.println(rs.getInt(1) + " " + rs.getString(2));
            }

            con.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Advantages of Type-3 Driver

  • It can be used when the user has multiple databases and want to use a single driver to connect all of them.
  • No need to install driver code on the client machine as the Type-3 driver is based on the server.
  • The back-end server component is optimized for the operating system on which the database is running.
  • Gives better performance than Type 1 and Type-2 drivers.

Disadvantages of Type-3 Driver

  • When middleware runs on different machines Type-4 drivers can be more effective.
  • It needs database-specific code on the middleware server.
Comment