What is the actual use of Class.forName(\"oracle.jdbc.driver.OracleDriver\") while connecting to a database? Why cant we just import the same class, instead why
Class.forName(“oracle.jdbc.driver.OracleDriver”) takes the class name as a string argument and loads it into memory. Second way of loading a class is to simply creating an instance of it using new. Disadvantage of second method is the newly created instance will be of no use if you don't need it.
There is a nice tutorial explains JDBC connection basics.