Update MySQL table from jsp

Posted by vishnu on Stack Overflow See other posts from Stack Overflow or by vishnu
Published on 2012-04-01T17:22:30Z Indexed on 2012/04/01 17:29 UTC
Read the original article Hit count: 311

Filed under:
|
|

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();

}

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database