일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- tomcat
- GPS
- PHP
- Google Map
- swingx
- dock
- 가우스
- oracle
- Ajax
- 전자정부프레임워크
- jQuery
- jsr 296
- sencha touch
- JDOM
- MFC
- 선택적조인
- PLSQL
- appspresso
- JSON
- MySQL
- iBATIS
- Spring
- phonegap
- WebLogic
- Eclipse
- Struts
- rowspan
- ibsheet
- node.js
- Android
Archives
- Today
- Total
Where The Streets Have No Name
[sampe] addBatch Query일괄실행 본문
PoolManager pool = PoolManager.getInstance();
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = (Connection) pool.getConnection();
pstmt = conn.prepareStatement("delete from neouserTable where name = ?");
for (int i=0; i < daumid.length; i++) {
pstmt.setString (1, name[i]);
pstmt.addBatch();
}
int results[] = pstmt.executeBatch();
returnValue ="true";
} catch (BatchUpdateException e) {
//오류 발생 이전의 SQL 문에서 insert된 행 갯수를 배열로 리턴한다.
int rsSuccessCnts[] = e.getUpdateCounts();
for( int i=0; i<rsSuccessCnts.length; i++ ) {
_logger.debug( i + "번째 쿼리 성공, 해당 쿼리에서 insert된 행 갯수: " + rsSuccessCnts[i] );
}
returnValue ="false";
} finally { PoolManager.close( pstmt, conn);}
출처 : http://neouser.tistory.com/54
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = (Connection) pool.getConnection();
pstmt = conn.prepareStatement("delete from neouserTable where name = ?");
for (int i=0; i < daumid.length; i++) {
pstmt.setString (1, name[i]);
pstmt.addBatch();
}
int results[] = pstmt.executeBatch();
returnValue ="true";
} catch (BatchUpdateException e) {
//오류 발생 이전의 SQL 문에서 insert된 행 갯수를 배열로 리턴한다.
int rsSuccessCnts[] = e.getUpdateCounts();
for( int i=0; i<rsSuccessCnts.length; i++ ) {
_logger.debug( i + "번째 쿼리 성공, 해당 쿼리에서 insert된 행 갯수: " + rsSuccessCnts[i] );
}
returnValue ="false";
} finally { PoolManager.close( pstmt, conn);}
출처 : http://neouser.tistory.com/54