Suppose user having multiple drivers installed in their system like MySQL Connector/J Driver, PostgreSQL Driver , etc. For registering the driver we use forName() method of 'Class' class is used to register the driver class. This method is used to dynamically load the driver class.
For Example :-
Class.forName(DRIVER_NAME);
Is there any way we can use multiple drivers, something like this :-
if (AS/400 Toolbox Driver) :: Class.forName("com.ibm.as400.access.AS400JDBCDriver");
else
if(Attunity Driver) :: Class.forName("com.attunity.jdbc.NvDriver");
else
if(MySQL Connector/J Driver) :: Class.forName("com.mysql.jdbc.Driver");
so that we can give more flexibility to developers to choose between installed drivers.