求助:使用C3P0出错!
配置文件的所有内容:
c3p0.jdbcUrl=jdbc:oracle:thin:@XXX.XXX.XXX.XXX:1521:ora10g c3p0.driverClass=oracle.jdbc.driver.OracleDriver c3p0.user=XXX c3p0.password=XXX c3p0.minPoolSize=3 c3p0.maxPoolSize=20 com.mchange.v2.log.MLog=com.mchange.v2.log.log4j.Log4jMLog com.mchange.v2.log.NameTransformer=com.mchange.v2.log.PackageNames com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=ALL
获取连接代码:
ComboPooledDataSource cpds = new ComboPooledDataSource(); conn = cpds.getConnection();出错信息:
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog). log4j:WARN Please initialize the log4j system properly. java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at c3p0.testc3p0.main(testc3p0.java:21) Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 2 more真心求助!谢谢大家!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
c3p0.jdbcUrl
这里是不是少了个连字符-
c3p0.jdbc-Url
很有可能是数据库归档日志已满,处理下日志。
我的是突然出现了这个问题。。。。。
原来是c3p0.properties这里面的部分配置信息没起到作用,困惑中。。。。
原来是c3p0.properties这里面的部分配置信息没起到作用,困惑中。。。。
从错误信息来看跟配置和代码无关了,看看数据库是否可连接
c3p0 在启动的时候会答应配置信息,打印出来的信息跟配置里的信息一致吗?
从错误信息来看跟配置和代码无关了,看看数据库是否可连接
从错误信息来看跟配置和代码无关了,看看数据库是否可连接