JDBC in Three-Tier Setups — Driver Types to Use In a three-tier architecture, and assuming the web server and DBMS run on the same machine, which JDBC driver type(s) are generally suitable choices?
-
AType 1 only
-
BType 2 only
-
CBoth Type 3 and Type 4
-
DAll of Type 1, Type 2, Type 3 and Type 4
-
EType 1 and Type 4 only
Answer
Correct Answer: Both Type 3 and Type 4
Explanation
Introduction:Choosing the right JDBC driver in a multi-tier architecture affects portability, performance, and operational simplicity. Pure Java drivers avoid native dependencies and are easier to deploy, especially across clustered or containerized environments.
Given Data / Assumptions:
- The architecture is three-tier (browser, web/app server, database).
- The web server and DBMS may be co-located, but portability is still valuable.
- Type 3 and Type 4 are pure Java and widely recommended.
Concept / Approach:Type 3 drivers use a middleware server; Type 4 drivers speak the DB wire protocol directly. Both run without native code, which simplifies deployment and scaling. Type 1 (JDBC-ODBC bridge) is obsolete and requires ODBC. Type 2 requires native libraries and complicates deployment and maintenance. Thus, Type 3 and Type 4 are the typical best choices in three-tier setups, regardless of server co-location with the DBMS.
Step-by-Step Solution:1) Prefer pure Java drivers for portability and ease of deployment.2) Discard Type 1 (legacy/ODBC) and Type 2 (native code).3) Select “Both Type 3 and Type 4.”
Verification / Alternative check:Modern vendor guidance and practice overwhelmingly favor Type 4 in particular; Type 3 is also acceptable where middleware fits the architecture.
Why Other Options Are Wrong:
- Type 1 only: Obsolete and unsuitable for production.
- Type 2 only: Ties you to native libraries; avoid when possible.
- All types: Overbroad; some types are undesirable.
- Type 1 and Type 4 only: Still includes the deprecated Type 1.
Common Pitfalls:Underestimating deployment friction from native dependencies in scaled-out environments.
Final Answer:Both Type 3 and Type 4