From the
java docs guide:
Class.forName by calling the method Class.forName. This explicitly loads the driver class.
loading the class causes an instance to be created and also calls DriverManager.registerDriver with that instance as the parameter, then it is in the DriverManager's list of drivers and available for creating a connection.
DriverManager.getConnection Once the Driver classes have been loaded and registered with the DriverManager class, they are available for establishing a connection with a database. When a request for a connection is made with a call to the DriverManager.getConnection method, the DriverManager tests each driver in turn to see if it can establish a connection.
It may sometimes be the case that more than one JDBC driver is capable of connecting to a given URL
In such cases, the order in which the drivers are tested is significant because the DriverManager will use the first driver it finds that can successfully connect to the given URL.
First the DriverManager tries to use each driver in the order it was registered. (The drivers listed in jdbc.drivers are always registered first.) It will skip any drivers that are untrusted code unless they have been loaded from the same source as the code that is trying to open the connection.
Shailesh