public static String changePassword(Connection conn,String userName,String password) throws Exception {
  PreparedStatement prep=conn.prepareStatement("UPDATE USERS SET PASSWORD=? WHERE NAME=?");
  prep.setString(1,password);
  prep.setString(2,userName);
  prep.executeUpdate();
  return password;
}

public static String changePassword ( Connection conn , String userName , String password ) throws Exception { PreparedStatement prep = conn . prepareStatement ( "UPDATE USERS SET PASSWORD=? WHERE NAME=?" ) ; prep . setString ( 1 , password ) ; prep . setString ( 2 , userName ) ; prep . executeUpdate ( ) ; return password ; }
utility method to change a password of a user . this method is secure , except that the old password is not checked .
