try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/bank", "root", "system");
PreparedStatement stm=con.prepareStatement("insert into newuserlogin (firstname, middlename, lastname, dateofbirth, emailid, mobile, username, password, confirmpassword ) values(?, ?, ?, ?, ?, ?, ?, aes_encrypt(?,'key'), aes_encrypt(?,'key') )");
stm.setString(1, name1);
stm.setString(2, name2);
stm.setString(3, name3);
stm.setString(4, dob);
stm.setString(5, email);
stm.setString(6, mobile);
stm.setString(7, username1);
stm.setString(8, password1);
stm.setString(9, password2);
int rs= stm.executeUpdate();
if(rs==1)
{
request.setAttribute("success", "successfully inserted");
RequestDispatcher rd=request.getRequestDispatcher("afterregistration.jsp");
rd.forward(request, response);
}
}
catch(Exception e)
{
System.out.println(e);
}
It working as expected: My password and confirmpassword have stored in encrypted form in database.
from sankalp sharma
Updated 3-May-18 8:33am
v3