Purpose of database drivers (JDBC/ODBC)
abstraction layers.
a driver translates a standard API into each database's wire protocol, so app code stays portable across vendors.
thinking the app talks raw protocol or that drivers are interchangeable across databases.
WHAT THIS TESTS Whether you understand the role of a translation layer that decouples application code from a specific database's proprietary network protocol.
WHY IT EXISTS Every database vendor uses its own binary wire protocol for connecting, authenticating, sending queries, and returning results. Without a standard, every application would hardcode the protocol details of one specific database, making it impossible to switch vendors and forcing developers to learn each protocol.
A GOOD ANSWER COVERS A database driver implements a standardized API and translates calls made against that API into the target database's actual wire protocol. JDBC defines a common interface for Java applications; ODBC is a language- and vendor-neutral standard. The application writes code against the generic API, getConnection, prepareStatement, executeQuery, and the driver does the real work: opening the TCP connection, performing the authentication handshake, serializing the query into the protocol's format, sending it, and parsing the binary result rows back into objects the application understands. Because the interface is uniform, you can change databases by dropping in a different driver with minimal or no application code changes.
COMMON WRONG ANSWERS Thinking the application sends raw SQL strings directly over a socket with no encoding, believing one driver works for all databases, or confusing the driver with an ORM (the ORM sits above the driver).
LIKELY FOLLOW-UPS Driver versus ORM versus connection pool layering; how prepared statements are handled at the driver level; native versus bridge drivers.
ONE CONCRETE EXAMPLE A Java reporting tool uses JDBC. Pointed at PostgreSQL it loads the Postgres JDBC driver; to run against MySQL the operator swaps in the MySQL driver and changes the connection URL, while the application's query code stays the same. Each driver internally speaks its own database's protocol, but the app only ever sees the uniform JDBC interface.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.