title: my sql :java.math.BigInteger cannot be cast to java.lang.Long
body: <p>I am doing a simple program in netbeans.
  Following is the Exception caused</p>
  
  <blockquote>
    <blockquote>
      <p>java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long</p>
    </blockquote>
  </blockquote>
  
  <p>
      </p>
  
  <pre><code>&lt;/head&gt;
  &lt;body&gt;
      &lt;form method="post" action="home/signup"&gt;
      Enter id:&lt;input type="text" name="userid"&gt;
      Enter password&lt;input type="password" name="pwd1"&gt;
      &lt;br&gt;
      &lt;input type="submit" value="Create"&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Servlet:</p>
  
  <pre><code>   {
      response.setContentType("text/html;charset=UTF-8");
      try (PrintWriter out = response.getWriter()) {
  
          try{
              Class.forName("com.mysql.jdbc.Driver");
              Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/login", "root","12345678");
              Statement stmt=conn.createStatement();
  
              int n=stmt.executeUpdate("INSERT INTO `login`.`tables` (`"+request.getParameter("userid")+"`) VALUES ('"+request.getParameter("pwd1")+"');");
  
              out.println("Rows updated: "+n);
  
  
  
          }catch(Exception ee){out.println(ee.toString());}
      }
  }
  </code></pre>
  
  <p>I tried doing everything and could not find a solution. Thanks in advance for helping.</p>