일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- JSON
- node.js
- Android
- Google Map
- sencha touch
- tomcat
- jsr 296
- 선택적조인
- appspresso
- rowspan
- MySQL
- Spring
- jQuery
- iBATIS
- GPS
- Eclipse
- Ajax
- PLSQL
- ibsheet
- Struts
- MFC
- WebLogic
- oracle
- PHP
- swingx
- JDOM
- dock
- 가우스
- phonegap
- 전자정부프레임워크
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