Want to Master Core Java & Database Concepts?
Subscribe to Ram N Java on YouTubeWhat is a Type 2 JDBC Driver?
In Java Database Connectivity (JDBC), a Type 2 Driver is officially termed the Native-API Driver, Partly Java Driver, or simply Native Driver.
It gets its name because it uses native client libraries provided by the database vendor to translate JDBC calls into native database calls directly on the client machine.
How Does the Type 2 Driver Work?
- Step 1: The Java application makes standard JDBC API calls.
- Step 2: The Type 2 Native-API driver converts these JDBC calls into vendor-specific native C/C++ API calls.
- Step 3: The vendor-specific client library communicates directly with the database engine.
- Step 4: The database executes the commands and sends the results back through the native client layer to the Java application.
Key Advantages of Type 2 Driver
- Faster Than Type 1: Offers significantly better execution speed and performance than the Type 1 JDBC-ODBC Bridge driver.
- Fewer Communication Layers: Eliminates the extra ODBC conversion layer, reducing overhead in communication.
Disadvantages and Limitations
- Client-Side Installation Required: Native vendor libraries (like Oracle client software) must be installed and configured on every client machine.
- No Web / Internet Support: Because client machines must have native libraries installed, it cannot be used over internet/web deployments.
- Lacks Portability: Written partly in native languages (C/C++), tying the driver to specific operating system architectures.
- Not Thread-Safe & Mostly Obsolete: Native C/C++ libraries are often not thread-safe, and Type 2 drivers have largely been superseded by pure Java Type 4 drivers.
Example of a Type 2 Driver
A classic example is Oracle's OCI Driver (Oracle Call Interface Driver), which uses native C libraries to communicate with the Oracle database server.
Watch More JDBC Tutorials
Click here to watch in Youtube : https://www.youtube.com/watch?v=9L7BRUTxbu8
Click the below Image to Enlarge
![]() |
| Type 2 JDBC Driver: Native-API driver/Partly Java driver(Native Driver) |
![]() |
| Type 2 JDBC Driver: Native-API driver/Partly Java driver(Native Driver) |


No comments:
Post a Comment