Difficulty: Easy
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:
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:
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:
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)
Discussion & Comments