title: What Class.forName() method does for JDBC?
body: <p>I have found that Class.forName method initializes static blocks.</p>
  
  <pre><code>Class.forName("com.mysql.jdbc.Driver").newInstance();
  </code></pre>
  
  <p>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?</p>
  
  <p>Here is my example code. I only add mysql-connector.jar to my library and When I run this code It works perfectly.</p>
  
  <pre><code>Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306","root","root");
  Statement stmt = con.createStatement();
  System.out.println("Created DB Connection....");
  </code></pre>