JDBC driver categories and networking: In Java Database Connectivity (JDBC), which driver Types are designed for use over communications networks (for example, connecting over TCP/IP to middleware or directly to a database server)? Select the most accurate option.

Difficulty: Easy

Correct Answer: Both Type 3 and Type 4

Explanation:


Introduction / Context:
JDBC drivers are classified into four historical types based on how they translate JDBC calls to database-specific protocols. Understanding which types are intended for networked use helps developers pick drivers that work well in distributed applications, servlet containers, and microservices.



Given Data / Assumptions:

  • The four classic JDBC types are Type 1, Type 2, Type 3, and Type 4.
  • We are concerned with drivers designed for communication over a network.
  • Typical production deployments use TCP/IP between application and database servers.


Concept / Approach:

Type 3 (network protocol driver) is a pure-Java driver that sends JDBC calls to a middleware server using a database-independent protocol; the middleware then translates to the database protocol. Type 4 (thin driver) is also pure Java and speaks the database’s native protocol directly to the database over the network. Both are built for networked environments and are common in app servers like Tomcat, JBoss, and Spring Boot deployments.



Step-by-Step Solution:

Identify driver types and transport behavior: Type 3 uses middleware over the network; Type 4 uses the DB’s native protocol over the network.Contrast with Type 1 (JDBC-ODBC bridge) and Type 2 (native API partly): these typically rely on local libraries or ODBC and are not ideal for pure network deployments.Conclude that both Type 3 and Type 4 are designed for network usage.


Verification / Alternative check:

Vendor documentation for widely used drivers (for example, PostgreSQL’s Type 4 driver, MySQL Connector/J) confirms direct TCP/IP connectivity without native libraries. Historical Type 3 products relied on middleware hubs reachable over the network.



Why Other Options Are Wrong:

Type 3 only / Type 4 only: incomplete; both are intended for networked operation.

Neither: contradicts the core purpose of Types 3 and 4.



Common Pitfalls:

Confusing Type numbers with performance guarantees; real-world performance depends on driver quality and database protocol, not just the Type. Also, Type 1 is obsolete and should not be used in production.



Final Answer:

Both Type 3 and Type 4

More Questions from JDBC, Java Server Pages, and MySQL

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion