public boolean UpdatePerson(long idperson, String pass, String fname,
			String lname, String address, String city, String state,
			String zipcode, String persontype, String department, String officeHr, String location) throws SQLException {
		int rowcount = 0;
		boolean result = false;
        String query,query1="";

		try {
			ps = (PreparedStatement) con
					.prepareStatement("update person set pass=?, fname=?, lname=?, address=?, city=?, state=?, zipCode=?, persontype =? where idperson=?");

			ps.setString(1, pass);
			ps.setString(2, fname);
			ps.setString(3, lname);
			ps.setString(4, address);
			ps.setString(5, city);
			ps.setString(6, state);
			ps.setString(7, zipcode);
			ps.setString(8, persontype);
			ps.setLong(9, idperson);
			rowcount = ps.executeUpdate();

			if (rowcount > 0) {
			   if(persontype =="I")
			   {
				   query ="select * from instructor where idperson =?";
				   ps1 =con.prepareStatement(query);
				   ps1.setLong(1, idperson);
				   rs1=ps1.executeQuery();
				   if(rs1.next())
				   {
					   query1 = "update instructor set department=?, officeHr=?, location=? where idperson=?";
					   ps2=con.prepareStatement(query1);
					   ps2.setString(1, department);
					   ps2.setString(2,officeHr);
					   ps2.setString(3, location);
					   ps2.setLong(4, idperson);
					   rowcount =0;
					   rowcount =ps2.executeUpdate();
					   if(rowcount>0)
					   {
						   result=true;
					   }
				   }
				   else
				   {
					   query1="insert into instructor (idperson,department,officeHr,location) values(?,?,?,?)";
					   ps2=con.prepareStatement(query1);
					   ps2.setLong(1, idperson);
					   ps2.setString(2, department);
					   ps2.setString(3,officeHr);
					   ps2.setString(4, location);
					   rowcount = 0;
					   rowcount =ps2.executeUpdate();
					   if(rowcount>0)
					   {
						   result=true;
					   }
				   }
				   
			   }
			   else
				   result= true;
			}

		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			try {
     	      
                ps.close();
                ps1.close();
                ps2.close();
                // connectionPool.free(con);
            } catch (SQLException e) {
               // TODO Auto-generated catch block
                 e.printStackTrace();
              } 
		}
		return result;
	}