[
https://issues.apache.org/jira/browse/IBATIS-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Clinton Begin closed IBATIS-485.
--------------------------------
Resolution: Won't Fix
Use a PingQuery to ensure connections are valid, or configure your server to
have unlimited connection timeouts.
> connection pool returns :"closed" connection?
> ---------------------------------------------
>
> Key: IBATIS-485
> URL: https://issues.apache.org/jira/browse/IBATIS-485
> Project: iBatis for Java
> Issue Type: Bug
> Affects Versions: 2.3.0
> Environment: Java 1.5, Java 1.6, Ubuntu linux, mysql 5.0
> Reporter: vasu nori
>
> is ibatis giving me a "closed" connection (i.e., connecton handle which used
> to have connection open to database, but no longer) in the following scenario
> 1. mapping xml file looks like this
> <transactionManager type="JDBC" commitRequired="false">
> <dataSource type="SIMPLE">
> <property name="JDBC.Driver"
> value="com.mysql.jdbc.Driver"/>
> <property name="JDBC.ConnectionURL"
> value="jdbc:mysql://localhost/feedserver"/>
> <property name="JDBC.Username" value="root"/>
> <property name="JDBC.Password" value="admin"/>
> <property name="Pool.MaximumActiveConnections"
> value="10"/>
> <property name="Pool.MaximumIdleConnections"
> value="5"/>
> <property name="Pool.MaximumCheckoutTime"
> value="120000"/>
> <property name="Pool.TimeToWait" value="10000"/>
> </dataSource>
> </transactionManager>
> 2. Java code
> SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
> <store sqlMap in a hashtable to be used for all queries during the
> life of the server>
> ....
> ....
> sqlMap.queryForObject(queryid_in_mapping_file, params);
> 3. if the server is left running overnight, the next morning here is the
> exception in the log file when the above statement is executed. seems like
> sqlMap gets a stale connection from the pool.
> 79621040 [btpool0-1] DEBUG com.ibatis.common.jdbc.SimpleDataSource -
> Checked out connection 19658898 from pool.
> 79621079 [btpool0-1] DEBUG java.sql.Connection - {conn-100030} Connection
> 79621079 [btpool0-1] DEBUG java.sql.Connection - {conn-100030} Preparing
> Statement: SELECT * from emp where id = ?;
> 79621084 [btpool0-1] ERROR java.sql.Connection - Error calling
> Connection.prepareStatement:
> com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No
> operations allowed after connection closed.Connection was implicitly closed
> due to underlying exception/error:
> ** BEGIN NESTED EXCEPTION **
> com.mysql.jdbc.CommunicationsException
> MESSAGE: Communications link failure
> Last packet sent to the server was 38 ms ago.
> STACKTRACE:
> com.mysql.jdbc.CommunicationsException: Communications link failure
> Last packet sent to the server was 38 ms ago.
> at
> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
> at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3134)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1818)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2537)
> at
> com.mysql.jdbc.ConnectionImpl.rollbackNoChecks(ConnectionImpl.java:4668)
> at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4553)
> at
> com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:629)
> at
> com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:222)
> at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
> at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:122)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:99)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.