This is not an interface that "works", but one of its implementations that is specific to your specific RDBMS provider. In fact, typically the provider provides an implementation of the Connection interface.
When you call
Connection conn = DriverManager.getConnection( "jdbc:jdbc:mysql://localhost:3306/ , connectionProps);
The driver manager looks through registered JDBC drivers, finds it for MySQL (it knows its MySQL from the connection string), passes the connection properties to the class constructor inside the MySQL JDBC driver, which implements Connection and returns the result. Connection return to you. For example, a driver can return an instance of the private-private MySqlConnection that implements Connection , and your program will use it to interact with the RDBMS without any class information, except that it implements Connection .
source share