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
seems
to work fine 90% of the time.  However, occassionlly I get a "No
operations
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
closed. 
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
2.0//EN"
                                 
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<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://mymachine:3306/mydatabase" />
                  <property name="JDBC.Username" value="myuser" />
                  <property name="JDBC.Password" value="mypassword" />
            </dataSource>
      </transactionManager>
      <sqlMap resource="getAllAddresses.xml" />
</sqlMapConfig>

I was hoping someone might be able to shed a little light on why this
might
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:
http://www.nabble.com/%22No-operations-allowed-after-connection-closed%2
2-occasionally-when-using-queryForList-tf3846980.html#a10895483
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.

Mime
View raw message