hibernate里面如何使用connection pool

cloudstrife 2006-03-02 01:25:19
想用第三方的c3p0连接池,并且做了如下配置。
<property name="c3p0.min_size">5</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.timeout">1800</property>
<property name="c3p0.max_statements">50</property>

hbm2ddl.auto=update

插入数据库时报错
[java] Caused by: java.sql.SQLException: com.mchange.v2.c3p0.PoolBackedData
Source@29428e [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectio
nPoolDataSource@1c6f579 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acq
uireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null,
breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassNa
me -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation ->
null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1c6f579, idle
ConnectionTestPeriod -> 0, initialPoolSize -> 5, maxIdleTime -> 1800, maxPoolSiz
e -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5,
nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1dfafd1 [ descr
iption -> null, driverClass -> null, factoryClassLocation -> null, identityToken
-> 1dfafd1, jdbcUrl -> jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=s
upermarket;SelectMethod=cursor, properties -> {user=******, password=******} ],
preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> fal
se, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false
], factoryClassLocation -> null, identityToken -> 29428e, numHelperThreads -> 3
] has been closed() -- you can no longer use it.

把connection pool这句注释掉就正常了,是不是c3p0的问题?我的虚拟主机不提供sqlserver的connection pool,所以只能用第三方的了。
...全文
126 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
cloudstrife 2006-03-03
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2006-03-02 01:25
社区公告
暂无公告