Language compatibility and drivers: since Java and C/C++ are “close,” is a database driver unnecessary? Evaluate this statement in the context of JDBC and DBMS connectivity.
-
AInvalid (you still need a JDBC driver to speak the DBMS protocol)
-
BValid (no driver is needed because the languages are similar)
-
CDepends on whether the DBMS exposes a REST API
-
DValid only for embedded databases
-
EApplies if the JVM runs on Linux
Answer
Correct Answer: Invalid (you still need a JDBC driver to speak the DBMS protocol)
Explanation
Introduction / Context: Programming language similarity does not imply wire-protocol compatibility with a database. This question reinforces that database connectivity requires a driver that implements the database’s protocol and JDBC interfaces, regardless of language similarities.
Given Data / Assumptions:
- Java applications must connect to a DBMS.
- JDBC defines standard interfaces.
- DBMS vendors expose proprietary or standardized network protocols.
Concept / Approach: JDBC drivers translate JDBC calls into the DBMS’s native protocol (Type 4) or into intermediate protocols/libraries (Types 1–3). Language syntax resemblance to C/C++ is irrelevant; without a driver, the JVM has no way to speak the DBMS protocol, authenticate, or marshal data correctly.
Step-by-Step Solution:
Identify the role of a JDBC driver: implement java.sql interfaces and network protocol.Note that C/C++ clients use different libraries (for example, OCI, libpq) rather than Java APIs.Conclude that a driver is necessary in Java to connect to relational databases.Therefore the claim is invalid.Verification / Alternative check: Attempting Connection without a driver class results in exceptions; adding the proper JDBC driver resolves connectivity.
Why Other Options Are Wrong:
- OS or REST exposure does not negate JDBC driver needs for JDBC access.
- Embedded databases still use drivers (for example, H2, Derby) even if in-process.
Common Pitfalls: Assuming language similarity implies binary compatibility; conflating JDBC with generic HTTP APIs.
Final Answer: Invalid (you still need a JDBC driver to speak the DBMS protocol)