請教Banq和各位道友連線失效問題

wzkl發表於2010-06-07
請教各位如下問題:
ibatis最大連線數${maxconn}為5:
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property value="${driver}" name="JDBC.Driver"/>
<property value="${url}" name="JDBC.ConnectionURL"/>
<property value="${username}" name="JDBC.Username"/>
<property value="${password}" name="JDBC.Password"/>
<property value="${maxconn}" name="Pool.MaximumActiveConnections"/>
<property value="${maxidel}" name="Pool.MaximumIdleConnections"/>
<property value="1000" name="Pool.MaximumWait"/>
</dataSource>
</transactionManager>
DAO繼承com.ibatis.dao.client.template.SqlMapDaoTemplate
有10個執行緒同時運算元據庫時,會報如下錯誤:

--- Check the SQL Statement (preparation failed).
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error accessing SimplePooledConnection. Connection has been invalidated (probably released back to the pool).
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error accessing SimplePooledConnection. Connection has been invalidated (probably released back to the pool).
at com.ibatis.dao.client.template.SqlMapDaoTemplate.update(SqlMapDaoTemplate.java:124)
如果將${maxconn}改為大於執行緒數,比如改為15,或者20,就不會有這種錯誤
我想請教各位,這裡使用了連線池為什麼會有連線無效的問題呢?感謝各位

[該貼被wzkl於2010-06-07 17:48修改過]

相關文章