title: HTTP Status 500 - javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.driver
body: <p>Hi I'm new to jsp servlets</p>
  
  <p>I am writing a simple login and registration application </p>
  
  <p>I am trying to connect with MySQL through java code, but I am getting   </p>
  
  <p><strong>HTTP Status 500 - javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.driver</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ page import="java.sql.*" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;%
   String user=request.getParameter("uname");
   String pwd=request.getParameter("pass");
   String fname=request.getParameter("fname");
   String lname = request.getParameter("lname");
      String email = request.getParameter("email");
      Class.forName("com.mysql.jdbc.driver");
      Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test_database","root","Welcome123");
      Statement st=con.createStatement();
      //ResultSet rs;
      int i=st.executeUpdate("insert into members(first_name, last_name, email, uname, pass, regdate) values ('" + fname + "','" + lname + "','" + email + "','" + user + "','" + pwd + "', CURDATE())");
   if(i&gt;0){
       //session.setAttribute("userid", user);
          response.sendRedirect("welcome.jsp");
         // out.print("Registration Successfull!"+"&lt;a href='index.jsp'&gt;Go to Login&lt;/a&gt;");
      } else {
          response.sendRedirect("index.jsp");
      }
   
  
  
  
  %&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have included the jar file as well, though I'm getting this error </p>
  
  <p>mysql-connector-java-5.1.34-bin this is the jar file which I am using.</p>