ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud LemaƮtre <arnaud.lemai...@free.fr>
Subject Can't get my 2 result sets !..
Date Tue, 19 Jun 2007 09:23:32 GMT
Hi,

I want to use multiple result sets support. It's not working for me. 
I can only get the first one. 

Please, can you tell me where i'm doing wrong ?

Logs below, are showing that only one result set is returned. I can't say
If mysql part is actually returning only one result ?... or may be hopefully
my code is wrong ;

My configuration :

Mysql Server version: 5.0.32-Debian_7etch1-log Debian etch distribution
mysql-connector-java-5.0.6-bin.jar
ibatis-2.3.0.677.jar
tomcat 5.5 + Apache 2.2

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 :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace = "myNamespace">
    <select id = "test" resultClass = "int, int">
        <![CDATA[
        select 1+1; select 2+2
        ]]>
    </select>
</sqlMap>

My iBATIS Config :
( i've set allowMultiQueries to true, when set to false (default) i've
Got sql syntax errors... 

<sqlMapConfig>
    <settings
        cacheModelsEnabled = "true"
        enhancementEnabled = "true"
        lazyLoadingEnabled = "true"
        maxRequests = "32"
        maxSessions = "10"
        maxTransactions = "5"
        useStatementNamespaces = "false"/>
    <transactionManager type = "JDBC">
        <dataSource type = "SIMPLE">
            <property name = "JDBC.Driver" value = "com.mysql.jdbc.Driver"/>
            <property name = "JDBC.ConnectionURL" value =
"jdbc:mysql://dev:3306/myDatabase?autoReconnect=true&amp;allowMultiQueries=t
rue&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8"/>
            <property name = "JDBC.Username" value = "myUsername"/>
            <property name = "JDBC.Password" value = " myPassword"/>
        </dataSource>
    </transactionManager>
    <sqlMap resource = "com/x/y/z/mySqlMap.xml"/>
</sqlMapConfig>

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





Mime
View raw message