title: Class.forName("com.mysql.jdbc.Driver").newInstance()
body: <p>I am having this error on Netbeans 7.2, it says that ClassNotFoundexception and InstantationException. I am really stuck on this matter. Kindly help me.</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      try {
          String driver = "com.mysql.jdbc.Driver";
          con = null;
          String username = "";
          String password = "";
  
          Class.forName("com.mysql.jdbc.Driver").newInstance();
  
          con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbName", "root", "password");
          Statement st = con.createStatement();
          ResultSet mar = st.executeQuery("SELECT * FROM table");
  
  
          Gson gson = new GsonBuilder().create();
          response.setContentType("application/json");  
          response.setCharacterEncoding("utf-8"); 
  
      } catch (SQLException e) {
                  String message = e.getMessage();
      }
  </code></pre>