'CallableStatement'에 해당되는 글 1건

  1. 2008.06.26 CallableStatement 사용하기
자바/SE2008. 6. 26. 02:28
원문 http://blog.naver.com/gospeler/130005477947

 CallableStatement cstmt = null;


 try {


    // 프로시저 콜

    cstmt = con.prepareCall("{call procedureName(?, ?)}");


    // IN parameter설정
    cstmt.setString(1, ?);


    // Out parameter의 Type설정
    cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);


    cstmt.execute();


    // Out parameter의 값을 얻고, 출력한다.
    System.out.println("result : " + c.getString(2));


 } catch(Exception e) {


    e.printStackTrace();
    throw e;


 } finally {


    if(cstmt != null) try { cstmt.close(); } catch(Exception ignore) {}


 }

Posted by 양군이당

댓글을 달아 주세요