Summary
JDBC defines a vendor-independent API to access databases and execute SQL statements. It consists of four main components. The driver implements the communication with a specific type of database, while the Connection
interface represents an open connection to a database server. Different kinds of Statement
interfaces are provided to execute queries and updates on a database, and to call functions. Finally, ResultSet
represents the results returned by a query. It also contains meta data about the queried table.
While JDBC is an easy way to interact with a database, there is still a mismatch of the tabular representation of data in a database and the object-graph of an object-oriented class design. The next chapter will introduce Hibernate as an example of an object-relational mapping (ORM) framework that adds a layer between the Java application and the database that translates between both the representations.