Batching of statements does not work for stored procedures ----------------------------------------------------------
Key: IBATIS-439 URL: https://issues.apache.org/jira/browse/IBATIS-439 Project: iBatis for Java Issue Type: Bug Components: SQL Maps Affects Versions: 2.3.0 Environment: All relational databases Reporter: Trevor Brosnan Fix For: 2.3.1 iBatis SQLMaps incorporates a mechanism for utilizing the JDBC API's underlying batching capabilities (Statement.addBatch()) to efficiently group a set of database operations together for maximum performance. This mechanism works as expected for dynamic SQL, but does not work for callable statements. This behavior has been deduced using P6Spy (configured to log to a Log4j SocketAppender) in conjunction with the SQL Profiler tool. As a note - NOT all JDBC Drivers support batching of callable statements. Older DB2 type 4 drivers did not support batching of callable statements. However, most modern drivers do (e.g. Sybase jConnect, Oracle JDBC Driver etc) The fix for this issue is straightforward. Change the method definition for sqlExecuteUpdate in class com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement to be as follows: protected int sqlExecuteUpdate(RequestScope request, Connection conn, String sqlString, Object[] parameters) throws SQLException { if (request.getSession().isInBatch()) { getSqlExecutor().addBatch(request, conn, sqlString, parameters); return 0; } else { return getSqlExecutor().executeUpdateProcedure(request, conn, sqlString.trim(), parameters); } } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.