A developer is building a Java microservice that must read and write a relational database. The developer asks what the service needs in order to open connections to the database through the standard Java data access API. What is required?
Select an answer to reveal the explanation.
Short Explanation
For Java, think JDBC: the J is your clue. You drop in the vendor's driver and give it a connection URL with the host, port and database name, and you're talking to the database. The ODBC option sounds familiar, but Java doesn't need the operating system's ODBC layer to connect.
Full Explanation
Java Database Connectivity (JDBC) is the standard Java API for relational database access. A Java application loads a JDBC driver supplied for the specific database engine and opens connections using a JDBC URL that encodes the driver subprotocol, host, port and database name, along with credentials supplied separately or through a connection pool. Most modern drivers are pure Java and communicate with the database's native wire protocol directly, so nothing else needs to be installed on the host. The claim that Java can reach databases only through the operating system's ODBC manager is false; old JDBC-to-ODBC bridges existed, but they were never required and are obsolete. OData is an HTTP-based protocol for exposing data as RESTful entity sets; using it would require someone to build and host an OData service, and it is not how a Java service opens database connections. Mounting the data directory over NFS and opening the table files bypasses the database engine, its locking, transactions and security, and the files are in an internal format the application cannot safely use. Exam caveat: ORMs such as Hibernate and Ebean sit on top of JDBC, so they still need the driver and URL. Operational check: confirm the driver version is compatible with the server version, test the URL with a simple query and verify that credentials come from a secured configuration rather than source code.