ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James, Steven" <steven.ja...@logicacmg.com>
Subject RE: "No operations allowed after connection closed" occasionally when using queryForList
Date Thu, 31 May 2007 15:03:25 GMT
I have had this error with mysql, check to see that you are not creating
more than one Sqlclient. Secondly you have lazy loading on so ensure you
are not calling a get on mapped object outside of the transaction. 

-----Original Message-----
From: CppPlease [mailto:theniguy@hotmail.co.uk] 
Sent: Donnerstag, 31. Mai 2007 16:51
To: user-java@ibatis.apache.org
Subject: "No operations allowed after connection closed" occasionally
when using queryForList

Hi there,

I'm using the code mentioned below (with try catches and such) and it
to work fine 90% of the time.  However, occassionlly I get a "No
allowed after connection closed" error.  A few more details are below.

--- Check the SQL Statement (preparation failed).  
--- Cause: java.sql.SQLException: No operations allowed after connection
StackTrace : com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in getAllAddresses.xml.  
--- The error occurred while executing query.  

This is the code (minus try/catch)

SqlMapClient sqlMap
Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
List myList = sqlMap.queryForList("getAllAddresses", null);

Finally this is the sqlMapConfig.xml I'm using

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config
      <settings cacheModelsEnabled="true" enhancementEnabled="true"
                   lazyLoadingEnabled="true" maxRequests="32"
                   maxTransactions="5" useStatementNamespaces="false" />
      <transactionManager type="JDBC">
            <dataSource type="SIMPLE">
                  <property name="JDBC.Driver"
                  <property name="JDBC.ConnectionURL"
value="jdbc:mysql://mymachine:3306/mydatabase" />
                  <property name="JDBC.Username" value="myuser" />
                  <property name="JDBC.Password" value="mypassword" />
      <sqlMap resource="getAllAddresses.xml" />

I was hoping someone might be able to shed a little light on why this
be happening sporadically?  The database is a v.simple mysql database
with 1
table.  Also using mysql-connector-java-3.1.7-bin.jar.

Help is much appreciated,
Thanks in advance.
View this message in context:
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

View raw message