请教Banq和各位道友连接失效问题

10-06-07 wzkl
请教各位如下问题:

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修改过]

猜你喜欢