Which classes are involved in connecting to a database?

DriverManager manages all JDBC drivers in the application. It provides a set of static methods and lazily loads available pre-configured drivers with the system class loader:The manager is responsible for creating instances of Connection – the key class for working with databases. An alternative (and even recommended) way to connect to a data source is using ConnectionBuilder. A builder is obtained from javax.sql.DataSource, which is formally part of Java EE, so we won't go into detail on it here.

Driveris the main class of the JDBC driver implementation. When loaded by the class loader, it registers itself in the DriverManager. So, besides pre-configured drivers, additional drivers can be loaded simply by calling Class.forName.

You can explicitly create a Connection through the driver, bypassing the manager and builder. The driver provides information about possible/required properties for its operation in the form of a DriverPropertyInfo array.

DriverAction is an additional interface that a Drivershould implement if it wants to receive notifications about deregistration from DriverManager.