Update MySQL table from jsp
- by vishnu
I have these in a jsp file. But these values are not updated in the mysql table. May be it is not commiting. How can i solve this ?
String passc1 = request.getParameter("passc1");
String accid = request.getParameter("accid");
int i = 0;
String sql =
" update customertb "
+ " set passwd = ?"
+ " where acc_no = ?;";
try {
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, passc1);
ps.setString(2, accid);
i = ps.executeUpdate();
} catch (Exception e) {
// do something with Exception here. Maybe just throw it up again
} finally {
con.close();
}