Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 12225 invoked from network); 23 Mar 2008 05:11:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Mar 2008 05:11:35 -0000 Received: (qmail 16813 invoked by uid 500); 23 Mar 2008 05:11:33 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 16794 invoked by uid 500); 23 Mar 2008 05:11:33 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 16783 invoked by uid 99); 23 Mar 2008 05:11:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Mar 2008 22:11:33 -0700 X-ASF-Spam-Status: No, hits=-1998.0 required=10.0 tests=ALL_TRUSTED,URIBL_BLACK X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Mar 2008 05:10:43 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4011C234C09E for ; Sat, 22 Mar 2008 22:09:24 -0700 (PDT) Message-ID: <1668980044.1206248964248.JavaMail.jira@brutus> Date: Sat, 22 Mar 2008 22:09:24 -0700 (PDT) From: "Clinton Begin (JIRA)" To: dev@ibatis.apache.org Subject: [jira] Closed: (IBATIS-441) Multiple result sets support broken In-Reply-To: <24733830.1182423866447.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IBATIS-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Clinton Begin closed IBATIS-441. -------------------------------- Resolution: Fixed Fix Version/s: 2.3.1 Assignee: Clinton Begin > Multiple result sets support broken > ----------------------------------- > > Key: IBATIS-441 > URL: https://issues.apache.org/jira/browse/IBATIS-441 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps > Affects Versions: 2.3.0 > Environment: Mysql Server version: 5.0.32-Debian_7etch1-log > mysql-connector-java-5.0.6-bin.jar > ibatis-2.3.0.677.jar > Reporter: Arnaud Lemaitre > Assignee: Clinton Begin > Priority: Blocker > Fix For: 2.3.1 > > > the following iBATIS code can not retrieve the 2 expected result sets. plain JDBC equivalent is provided and is working properly. > platform specific note : > multiple queries (allowMultiQueries=true on JDBC url) is not working for Mysql server 4.0.24 (tested). apparently requires higher version > 4.1 > (following tests have been done using Mysql 5.0.32) > Here is my Code (for test purpose) : > ... > List results = null; > SqlMapClient sqlMap = IbatisUtil.getSqlMapInstance(); > try{ > results = sqlMap.queryForList( "test" ); > } > catch( SQLException sqle ) { > throw CoreException.wrap( sqle ); > } > > final Logger logger = Logger.getLogger( MyCLass.class ); > > logger.info ( "results.size() = " + results.size() ); > ... > mySqlMap.xml : > > > > > > My iBATIS Config : > ( i've set allowMultiQueries to true, when set to false (default) i've Got sql syntax errors... > > cacheModelsEnabled = "true" > enhancementEnabled = "true" > lazyLoadingEnabled = "true" > maxRequests = "32" > maxSessions = "10" > maxTransactions = "5" > useStatementNamespaces = "false"/> > > > > > > > > > > Log4j output : > DEBUG TP-Processor3 java.sql.Connection - {conn-100000} Connection > DEBUG TP-Processor3 java.sql.Connection - {conn-100000} Preparing Statement: select 1+1; select 2+2 > DEBUG TP-Processor3 java.sql.PreparedStatement - {pstm-100001} Executing Statement: select 1+1; select 2+2 > DEBUG TP-Processor3 java.sql.PreparedStatement - {pstm-100001} Parameters: [] DEBUG TP-Processor3 java.sql.PreparedStatement - {pstm-100001} Types: [] DEBUG TP-Processor3 java.sql.ResultSet - {rset-100002} ResultSet DEBUG TP-Processor3 java.sql.ResultSet - {rset-100002} Header: [1+1] DEBUG TP-Processor3 java.sql.ResultSet - {rset-100002} Result: [2] DEBUG TP-Processor3 com.ibatis.common.jdbc.SimpleDataSource - Returned connection 1511627065 to pool. > INFO TP-Processor3 com.x.y.MyCLass - results.size() = 1 > Here is the test : > package com.test; > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.ResultSet; > import java.sql.Statement; > public class test { > public static void main( String[] args ) { > new test( args ); > } > public void testJDBCConnection() throws Exception > { > Class.forName( "com.mysql.jdbc.Driver" ); > > String url = "jdbc:mysql://myHost:3306/myDatabase?autoReconnect=true&allowMultiQueries=true&characterEncoding=UTF-8&characterSetResults=UTF-8"; > > Connection conn = DriverManager.getConnection( url, "myDatabase", "myPassword" ); > > try > { > String sqlString = "SELECT 1+1; SELECT 2+2; SELECT 3+3"; > System.out.println("Before executing"); > > > Statement stmt = conn.createStatement(); > stmt.execute( sqlString ); > for (;;) { > int updateCount = stmt.getUpdateCount(); > if (updateCount >= 0) { > // report rows affected... > } > else { > ResultSet rs = stmt.getResultSet(); > if (rs == null) > break; > if ( rs.next() ) > System.out.println( "result :" + rs.getInt(1) ); // process resultset .... > } > stmt.getMoreResults(); > } > > System.out.println("After executing"); > } > catch (Exception e) > { > System.out.println("Exception: " + e); > } > > } > public test( String[] args ) { > try > { > testJDBCConnection(); > } > catch (Exception e) > { > System.out.println("Exception: " + e); > } > } > } > And the output : > Before executing > result :2 > result :4 > result :6 > After executing -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.