I am doing a simple program in netbeans. Following is the Exception caused
java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
</head>
<body>
<form method="post" action="home/signup">
Enter id:<input type="text" name="userid">
Enter password<input type="password" name="pwd1">
<br>
<input type="submit" value="Create">
</form>
</body>
Servlet:
{
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());}
}
}
I tried doing everything and could not find a solution. Thanks in advance for helping.