Setting Out Parameter for Stored Procedure fails. Error says call "getMoreResults ---------------------------------------------------------------------------------
Key: IBATIS-385 URL: https://issues.apache.org/jira/browse/IBATIS-385 Project: iBatis for Java Issue Type: Bug Components: SQL Maps Affects Versions: 2.2.0 Environment: jTDS against MS SQL Server 2000. Java 1.4.2_13 Reporter: Brett Knights I'm calling getSqlMapClientTemplate().insert on a stored procedure with one output parameter. <parameterMap id="insertUserParams" class="com.tanner.eda.model.User" > <parameter property="id" jdbcType="INTEGER" javaType="java.lang.Long" mode="OUT"/> <parameter property="accountId" jdbcType="INTEGER" javaType="java.lang.Long" mode="IN"/> ... </parameterMap> <procedure id="addUser" parameterMap="insertUserParams"> {call tewciWebUser (?,?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)} </procedure> I've lost the exact error message but it told me that SqlExecutor. executeUpdateProcedure was calling retrieveOutputParameters(request, cs, mappings, parameters, null); before any available record sets or result counts had been cleared. To fix this I inserted the following at line after cs.execute (line 226 on my copy of the source) rows = clearResults(cs); and added the following method to the SqlExecutor: private int clearResults(Statement stmt) throws SQLException{ int rowCount = 0; while(true){ if(moveToNextResultsSafely(stmt)){ ResultSet rs = stmt.getResultSet(); if( rs != null){ rs.close(); continue; } } else{ int availRows = stmt.getUpdateCount(); if(availRows >= 0) { rowCount += availRows; continue; } } break; } return rowCount; } executeUpdateProcedure -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira