Announcement Announcement Module
Collapse
No announcement yet.
JDBC batchUpdate and CallableStatements Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JDBC batchUpdate and CallableStatements

    In look at batch updates for CallableStatements I found the following information:

    The ability to make batch updates is the same for CallableStatement objects as it is for PreparedStatement objects. In fact, a CallableStatement object is restricted to the same functionality that a PreparedStatement object has. More precisely, when using the batch update facility, a CallableStatement object can call only stored procedures that take input parameters or no parameters at all. Further, the stored procedure must return an update count. The CallableStatement.executeBatch method (inherited from PreparedStatement) will throw a BatchUpdateException if the stored procedure returns anything other than an update count or takes OUT or INOUT parameters.
    Based on these restrictions, could you use PreparedStatement to call the stored procedure in batch? Or do you still need to use CallableStatements? If that is true, could someone point me to documentation that explains why stored procedures must be called with CallableStatements.

  • #2
    As far as I can tell CallableStatement is just a PreparedStatement with the ability to handle OUT parameters and multiple resultsets.

    Since batchUpdate requires no OUT parameters, no result set and only a single update count, I don't see why you can't call a stored procedure in batch using the BatchSqlUpdate object.

    Comment

    Working...
    X