jdbc批量调用存储过程

//批量调用存储过程
public int[] impCdrinterimday(Vector<String> filename){
Connection conn=null;
if(filename==null){
return null;
}
CallableStatement proc = null;
conn=getConnection();
int[] updateCount= null;
try {
conn.setAutoCommit(false);
proc=conn.prepareCall("{ call PG_SPILT_BASIC.cp_ct_cdr_interim_spilt_f(?,?)}");
for(String f: filename){
log.warn((++i)+" "+f+" "+Thread.currentThread().getName());
proc.setString(1, f);
proc.setInt(2, i);
proc.addBatch();
}

updateCount= proc.executeBatch();
conn.commit();
conn.setAutoCommit(true);
proc.clearBatch();
close(conn,proc);

} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
log.error(e1.toString(),e1.fillInStackTrace());
}
log.error(e.toString(),e.fillInStackTrace());
}

return updateCount;
}


//批量执行sql
public int[] updateendmailList(Vector<SendmailListVO> vector) throws SQLException{
//批量执行sql

int[] result=null;
Connection conn=null;
PreparedStatement ps=null;
String sql="update ct_sendmaillist_new t set t.NUMSENDFLAG=1 where t.NUMMAILLISTGUID=?";
conn=getConnection();
ps=conn.prepareStatement(sql);
for(SendmailListVO vo:vector){
ps.setLong(1, vo.getNummaillistguid());
ps.addBatch();
}

result=ps.executeBatch();
close(conn, ps);
return result;

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值