학원/JDBC

10/24 27-8 (UpdateSQL.prepared)

도원결의 2022. 10. 24. 19:38

이번엔 수정

public class UpdateSQLMore extends IConnectImpl {

	@Override
	public void execute() throws Exception {
      try{	
       	 connect(ORACLE_URL,"KOSMO","KOSMO");         
         psmt = conn.prepareStatement(”UPDATE member SET name=?, password=?
         										where username=?“);
         while(true){
                 psmt.setString(3,getValue("수정 할 아이디"));
                 psmt.setString(1,getValue("수정 할 이름"));
                 psmt.setString(2,getValue("수정 할 비밀번호"));
                 System.out.println(psmt.executeUpdate()+"행이 수정 되었습니다.");	
          }
      }
      finally{
        close();
      }
    }

	public static void main(String[] args) throws Exception {
		new UpdateSQLMore().execute();			
	}
  }