title: Using JBDC 4.0 driver in /WEB-INF/lib and yet Class#forName() is still required to load it
body: <p><br> I'm trying to get access to my database via jsp and I have the following code:</p>
  
  <pre><code>&lt;% 
          String username = request.getParameter("username");
          String password = request.getParameter("password");
          String value = "vuoto";
  
  
          Class.forName("com.mysql.jdbc.Driver");
          Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/onlinebookstore", "root", "sesame");
          Statement statement = connection.createStatement();
          ResultSet result = statement.executeQuery("SELECT * FROM users WHERE email = '" + username + "' " + "AND" + " password = '" + password + "'");
          if(result.next()) {
             value = "eccomi";
          }
          connection.close();
  %&gt;
  </code></pre>
  
  <p>I don't understand why I need to use Class.forName because I read that from JDBC 4.0 it is not necessary, but if I remove that statement it doesn't work. In my libraries I added MySQL JDBC Driver -mysql-connector-java-5.1.23-bin.jar</p>