코드 예)
DBConnectionPool connPool = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
CallableStatement cstmt = null;
.
.
.
.
클래스 상단 전역 변수로 선언되어있는 데이터베이스 관련 객채들.
코드상엔 없지만 connPool 커넥션풀에 데이터베이스 커넥션 싱글톤 처리가 되었다고 가정한다.
try{
//쿼리
String sql = "{ CALL PROC_COMMENT_INSERT( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) }";
//커넥션을 얻는다.
conn = connPool.getConnection();
//스테이트먼트 객체를 얻는다
cstmt = conn.prepareCall(sql);
//전달 파타미터 셋팅
cstmt.setLong(1, ac_article_seq);
cstmt.setLong(2,(long)0);
cstmt.setLong(3, mb_seq);
cstmt.setString(4,mn_nickname);
cstmt.setInt(5,Integer.parseInt((String)member.get("MB_LEVEL")));
cstmt.setString(6,"U");
cstmt.setString(7,comment);
cstmt.setString(8,(String)member.get("MB_LAST_LOGIN_IP"));
//전달 파라미터 셋팅끝
//프로시저 리턴 파라미터
cstmt.registerOutParameter(9, java.sql.Types.BIGINT);
cstmt.registerOutParameter(10, java.sql.Types.SMALLINT);
cstmt.registerOutParameter(11, java.sql.Types.TINYINT);
cstmt.registerOutParameter(12, java.sql.Types.BIGINT);
//리턴 파라미터 끝
//실행
cstmt.execute();
}catch(Exception e){
setTextAppend("등록실패");
setTextAppend(e.toString());
}finally{
if(rs != null){ try{ rs.close(); }catch(SQLException e){} }
if(cstmt != null){ try{ cstmt.close(); }catch(SQLException e){} }
connPool.returnConnection(conn);
}
2016년 12월 18일 일요일
피드 구독하기:
댓글 (Atom)
[lunux]리눅스 폴더별 용량 확인
리눅스 폴더별 용량 확인 조회 하고자 하는 디렉토리 리스트가있는 경로로 이동후 du -h --max-depth=1
-
pom.xml <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId&g...
-
수십대의 서버에 특정 쉘을 실행한다거나 파일을 수정해야할경우 호스트 입력 아이디 입력 패스워드 입력은 여간 짜증나는일이 아닐수 없다. 이를 한방에 해주는 방법 teraterm 를 설치한다( putty 는 버리자 ) 예를 들면 19...
-
다른 페이지로 이동 해서 프로세스 실행후 다시 이전 페이지로 돌아와야할경우 page url 을 파라미터로 넘겨야 하는데 location.protocol : 프로토콜 예) https: location.host : 도메인 예) naver.com l...
댓글 없음:
댓글 쓰기