Description
SQLExecutor.getFirstResultSet method call goes into an infinite loop when using Stored procedure in MySQL DB.
If there are no more results, stmt.getUpdateCount() in moveToNextResultsIfPresent() must return -1. But, proved that always return 0.
Below is environment setting and source file.
A stored proc of application goes to infinite loop, but consol command is preformed correctly.
[mvn dependency]
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
[sqlMap.xml]
<parameterMap id="PriceProcedure" class="java.util.Map">
<parameter property="nProdC" jdbcType="INTEGER" javaType="java.lang.Integer" mode="IN" />
<parameter property="bReturn" jdbcType="INTEGER" javaType="java.lang.Integer" mode="OUT" />
</parameterMap>
<procedure id="procedureRenewalProduct" parameterMap="PriceProcedure" >
</procedure>
========================================================================================================
The stored procdedure body is below. This is simple procedure that return same integer value of IN parameter.
On the result, after procedure call phase is performed, it returns result value correctly.
mysql> show create procedure RenewalProduct_JYS\G
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1. row ***************************
Procedure: RenewalProduct_JYS
sql_mode: NO_UNSIGNED_SUBTRACTION
Create Procedure: CREATE DEFINER=`throat`@`localhost` PROCEDURE `RenewalProduct_JYS`(IN nProdC INT, OUT bReturn INT)
BEGIN
SET bReturn = nProdC;
END
1 row in set (0.00 sec)
- 1. row ***************************
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
mysql> call RenewalProduct_JYS(12345, @bReturn);
Query OK, 0 rows affected (0.00 sec)
mysql> select @bReturn;
----------
@bReturn |
----------
12345 |
----------
1 row in set (0.00 sec)
Attachments
Issue Links
- duplicates
-
IBATIS-384 SQLExecutor.getFirstResultSet goes into infinite loop
- Closed