Hi,

Following my previous mail, i did jdbc quick and dirty equivalent to my
programm. (without changing my db configuration)

So Ibatis 2.3 seems to be broken regarding multi result sets support.
And apparently it’s not only when resultclass is set to « int, int » since
I did some different tests returning POJOs etc. 

If i can fix it myself  i'll submit a patch. Hope it’s not tricky.

Regards,
Arnaud

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=tr
ue&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



Reply via email to