Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-587

SQLExecutor.getFirstResultSet goes into infinite loop in stored procedure call.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • 2.3.4
    • 2.3.5
    • Core
    • None

    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" >

      { CALL RenewalProduct_JYS(?, ?) }

      </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)

      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

          Activity

            People

              Unassigned Unassigned
              pine96 Young Sub, Jeon
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: