title: Why am I getting "No suitable driver found for jdbc:mysql://localhost:3306/test2"?
body: <pre><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test2
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at com.room302.util.DBConnectionUtil.getConnection(DBConnectionUtil.java:32)
      at com.room302.dao.roomDAO.addexpense(roomDAO.java:26)
      at com.room302.servlet.Navigator.doPost(Navigator.java:69)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>My Util file is as follows:</p>
  
  <pre><code>public class DBConnectionUtil
  {   
      private static final String USERNAME="root";
      private static final String PASSWORD="1234";
      private static final String URL="jdbc:mysql://localhost:3306/test2";
      private static final String DRIVER_NAME="mysql";
  
      private static Connection conn=null;
  
      static
      {
          try
          {
              System.out.println("searching for driver");
              Class.forName(DRIVER_NAME);
          }
          catch(ClassNotFoundException cnfe)
          {                               
          }
      }
  
      public static Connection getConnection() throws SQLException
      {           
          conn = DriverManager.getConnection(URL,USERNAME,PASSWORD);                      
          return conn;
      }
  
     public static void closeConnection(Connection conn)
     {
         if(conn!=null)
         {
             try
             {
                 conn.close();
             }
             catch (Exception e)
             {
             }
         }
     }
  }
  </code></pre>
  
  <p>I have put MySQL connector in the buildpath and also in lib folder of web-inf.
  Why am I still getting this error?</p>