public static int changePassword(String userid, String oldpassword, String newPassword){

		PreparedStatement pst = null;  
		Connection conn=null;
		boolean result = false;
		try {  
			conn=ConnectionPool.getConnectionFromPool();
			PreparedStatement pst2 =conn.prepareStatement("SELECT COUNT(*) FROM PERSON WHERE USERID=? AND PASSWORD=?");
			pst2.setString(1, userid);
			pst2.setString(2, oldpassword);
			ResultSet rs = pst2.executeQuery();
			int count =0;
			if(rs.next()){
				count = rs.getInt(1);
			}
			if(count==1){
				pst = conn  
						.prepareStatement("UPDATE PERSON SET PASSWORD=SHA1(?) WHERE USERID=? AND PASSWORD=SHA1(?)");  
				pst.setString(1, newPassword);  
				pst.setString(2, userid);
				pst.setString(3, oldpassword);
				pst.executeUpdate();
				return 1;
			}else{
				return 0;
			}
		}catch (Exception e) {  
			System.out.println(e);  
		} finally {  
			if(conn!=null){
				ConnectionPool.addConnectionBackToPool(conn);
			}
			if (pst != null) {  
				try {  
					pst.close();  
				} catch (SQLException e) {  
					e.printStackTrace();  
				}  
			}  
		}
		return 0;
	}