JDBC driver suitability for web clients: can Type 3 and Type 4 JDBC drivers be used with servlets and with applets (where applicable)? Decide whether the statement is accurate.
-
AValid (Type 3 and Type 4 are pure Java approaches suitable for servlets and historically for applets)
-
BInvalid (only Type 2 drivers work in servlets)
-
CApplies only when the DBMS is MySQL
-
DValid only on desktop Windows clients
-
EDepends on ODBC being installed on the client
Answer
Correct Answer: Valid (Type 3 and Type 4 are pure Java approaches suitable for servlets and historically for applets)
Explanation
Introduction / Context: Web-tier Java applications (servlets) and legacy client-side Java applets historically favored driver types that avoided native dependencies. This question tests recognition of which JDBC driver categories fit that bill.
Given Data / Assumptions:
- Servlets run in a Java web container on the server.
- Applets (now obsolete) ran in a sandboxed client browser JVM.
- Drivers requiring native libraries are unsuitable or inconvenient for these use cases.
Concept / Approach: Type 3 drivers are net-protocol, middleware-based, pure Java; Type 4 drivers are pure Java “thin” drivers that speak the database protocol directly. Both avoid client-side native code and ODBC. Therefore, they are appropriate for servlets and, historically, for applets, subject to security and distribution constraints. Type 1 needs ODBC; Type 2 uses native libraries—both are problematic in these scenarios.
Step-by-Step Solution:
Identify driver characteristics: Type 3 and Type 4 are pure Java.Map to runtime: web/app clients benefit from no native dependencies.Conclude suitability for servlets (server-side) and historically applets (client-side).Therefore the statement is valid.Verification / Alternative check: Review vendor documentation for popular JDBC drivers (Oracle thin, PostgreSQL, MySQL Connector/J): all are Type 4 and widely used in servlets.
Why Other Options Are Wrong:
- Type 2 requires native code; ODBC is unrelated for Type 3/4.
- Suitability is not restricted to a single DBMS or OS.
Common Pitfalls: Confusing “applet” constraints with “servlet” constraints; overlooking security policy requirements for client-side deployment.
Final Answer: Valid (Type 3 and Type 4 are pure Java approaches suitable for servlets and historically for applets)