Steps for creating connection with the database -

Step 1- Load the Driver

The first step to create connection with database is to load the specific driver class in the application environment so that it will be available when we need it for opening the connection.
The easiest way to load the driver is to use static method forName() provided by a class named Class. It has the following syntax -

static Class <?> forName(String Driver_Class_Name) throws ClassNotFoundException
Here Class is a predefined class that contains a static method forName(). The method takes a string parameter that should be the driver class name for specific database that you want to use. This method can throw a ClassNotFoundException, if driver class not found in execution path.

Example -

catch(ClassNotFoundException ex)
System.out.println("Driver Class is not loaded");
Different RDBMS makes use of different driver classes some of them are as follows -
1- for MySql -
2- for Oracle -
3- for IBM DB2 -