.
Besides, what is class forName used for?
The Class. forName is used to load any given class (within double quotes as String) at run time. For example, when we use IDE, we see there will be a GUI builder which allows us to drag and drop the buttons, text fields, etc.
Also Know, what is the use of forName method in JDBC? forName() The most common approach to register a driver is to use Java's Class. forName() method, to dynamically load the driver's class file into memory, which automatically registers it.
In this manner, why do we use class forName com mysql JDBC driver?
Applications no longer need to explictly load JDBC drivers using Class. forName(). It will create a new instance of the com. Driver class and hence call the static initialization which will register the driver with the DriverManager so you can create mysql connections based on the URL you use in the second line.
How does DriverManager getConnection work?
The getConnection(String url, Properties info) method of Java DriverManager class attempts to establish a connection to the database by using the given database url. The appropriate driver from the set of registered JDBC drivers is selected. Properties are implementation-defined as to which value will take precedence.