PreparedStatement , CallableStatement and Performance Considerations

前端 未结 2 1123
眼角桃花
眼角桃花 2020-12-31 08:51

I have a oracle stored proc that needs to be called from my Java program. I had used CallableStatement to pass parameters to the stored proc. I am

2条回答
  •  旧时难觅i
    2020-12-31 09:27

    Shouldn't you consider using batch?

    conn.setAutoCommit(false);
    CallableStatement stmt = conn.prepareCall(sql);
    while(true) {
        stmt.setInt(1, value);
        stmt.addBatch();
    }
    stmt.executeBatch()
    conn.commit();
    

提交回复
热议问题