I have found that Class.forName method initializes static blocks.
Class.forName("com.mysql.jdbc.Driver").newInstance();
After jdbc 4.0 you don't need to call this method. But people always use this method even after jdbc 4.0 version. My question is why do I need to use this method if I use jdbc 4.0? What Class.forName() method does for JDBC 4.0 and after?
Here is my example code. I only add mysql-connector.jar to my library and When I run this code It works perfectly.
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306","root","root");
Statement stmt = con.createStatement();
System.out.println("Created DB Connection....");