DriverManager
is the class that allows you to load the < a href="https://docs.oracle.com/javase/8/docs/api/java/sql/Driver.html"> Driver
s database and create connections to one or more databases. In Java SE, it is the only class that connects with the loaded drivers and obtains a database connection. This is done using the Driver#connect
method.
DataSource
is the interface that lets you define a pool of connections. The implementations of this interface, what they will do, will be to create a group of connections and they will be stored in a memory space (this is known as a pool). To create connections, internally use DriverManager#getConnection
multiple times (1 per connection) or Driver#connect
and configurations that have been loaded to create the instance of DataSource
.