Your problem is in the following code:
String query = "update test.Customer set LoginPassword=?, ConfirmPassword=? where LoginId=?" ;
PreparedStatement ps = c.prepareStatement(query);
ps.setString(1, loginId);
ps.setString(2, loginPassword);
ps.setString(3, confirmPassword);
The order of your placeholders in your SQL query string is:
- LoginPassword
- ConfirmPassword
- LoginId
But the order of parameters is
- LoginId
- LoginPassword
- ConfirmPassword
So you are trying to update the record with LoginId
of value ConfirmPassword
which is very unlikely to exist.
N.B. Why are you storing the confirm password? Wouldn't it make more sense for the servlet to check that LoginPassword
is equal to ConfirmPassword
and showing an error if it isn't rather than updating the DB?