-
c3p0的问题,java.sql.SQLException: Some resources failed to close properly5
报错的完整信息:
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@71a2f5b1
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:571)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.j
ava:470)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
2012-05-14 19:45:48.850 WARN - com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:972)Failed to d
estroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@646d6aa0
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@646d6aa0
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:571)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.j
ava:470)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
什么情况下回出现这种问题呢?
数据库用的是oracle,
程序化中用了两个数据库连接池,属性都一样。
数据源配置配置了如下属性:
#连接池最大连接数
oracle.maxPoolSize=30
#连接池最小连接数
oracle.minPoolSize=5
#连接池初始连接数
oracle.initialPoolSize=5
#连接池连接空闲时间
oracle.maxIdleTime=10000
检查了java程序,程序中用到了大量preparedstatement,但是最后都有采取关闭(可以保证);
本地测试时不会出现这种情况,但现上线了会出现,会不会跟服务器压力过大有关?
问题补充:7454103 写道引用but, if your application uses Statement caching, you might try upgrading to c3p0-0.9.0-pre6. Earlier versions of c3p0 closed cached PreparedStatements and their parent Connections asynchronously, such that the order of the closes was not guaranteed, Statements could be closed after or simultaneous to parent Connect close.
More recent versions of c3p0 ensure that all cached PreparedStatements are closed prior calling Connection close. This may eliminate the stack traces that you're seeing.
Anyway, give c3p0-0.9.0-pre6 a shot...
c3p0 你的版本多少?
版本是0.9.1.2
2012年5月16日 10:50
1个答案 按时间排序 按投票排序
-
引用but, if your application uses Statement caching, you might try upgrading to c3p0-0.9.0-pre6. Earlier versions of c3p0 closed cached PreparedStatements and their parent Connections asynchronously, such that the order of the closes was not guaranteed, Statements could be closed after or simultaneous to parent Connect close.
More recent versions of c3p0 ensure that all cached PreparedStatements are closed prior calling Connection close. This may eliminate the stack traces that you're seeing.
Anyway, give c3p0-0.9.0-pre6 a shot...
c3p0 你的版本多少?
2012年5月16日 13:44
相关推荐
在Java编程中,`java.sql.SQLException: 结果集已耗尽` 是一个常见的错误提示,通常出现在处理数据库查询结果集时。这个异常表明程序试图访问已经没有数据的结果集中下一行,即所有行已经被遍历完,尝试访问超出范围...
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK ……
标题中的“Caused by: java.sql.SQLException: JZ0SJ: 没有在此数据库中发现元数据存取器信息。 请按 jConnect 文档中所述安装”是一个典型的错误信息,表明在尝试使用Java数据库连接(JDBC)驱动程序访问数据库时...
在oracle里面运行一下,解决Exception java.sql.SQLException ORA-00600 内部错误代码
### 服务器出现java.sql.SQLException No suitable driver found for 的解析与解决方案 #### 问题背景 在进行Servlet开发过程中,尤其是在尝试连接数据库时,遇到了一个常见的异常:“java.sql.SQLException: No ...
7. **优化性能**:使用连接池(如C3P0、HikariCP)可以有效地管理数据库连接,提高应用性能。此外,还可以配置批处理、预编译语句等优化策略。 8. **异常处理**:在处理数据库操作时,必须捕获SQLException和其他...
- `java.sql.SQLException: ORA-01652: unable to extend temp segment by X in tablespace TEMP`: 临时表空间不足。增加临时表空间大小或优化使用临时表空间的查询。 以上是Oracle数据库操作中常见的`java.sql....
Q: I am working with ... I am using updateBinaryStream method of resultset to update the BLOB field but it is failing after giving following exception java.sql.SQLException: Internal Error: Unable to
java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql ...
主要给大家介绍了关于MySQL存储表情时报错:java.sql.SQLException: Incorrect string value: 'xF0x9Fx92xA9x0Dx0A...'的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
本文主要介绍了关于MySQL存储表情报错:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\xA9\x0D\x0A…’的相关解决方法,分享出供大家参考学习,下面话不多说了,来一起看看详细的介绍: ...
在Java编程中,数据库连接是应用开发不可或缺的一部分。在MySQL 5.6版本中,我们需要一个合适的驱动来建立...例如,Apache的DBCP或C3P0都是常用的Java连接池库。同时,注意处理异常和关闭连接,以保持良好的编程习惯。
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 提示的是用户访问被拒绝,原因是密码不正确,但是我们明明配置的是正确的密码,原因就在yml中: spring: datasource: ...
Unknown column 'fillMen' in 'field list' java.sql.SQLException: Operation not ...java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
import java.sql.SQLException; ``` 3. **注册驱动**:在使用MySQL驱动前,需要通过`Class.forName()`方法注册驱动。尽管在较新的JDBC版本中这个步骤可以省略,但为了兼容性,很多示例代码仍然包含它: ```java ...
当你尝试连接到MySQL数据库时,可能会遇到一个特定的异常:“java.sql.SQLException: The server time zone value ‘?й???????’ is unrecognized or represents more than one time zone”。这个错误表明服务器...
绝对好用的9i驱动包+10g驱动包 解决java.sql.SQLException: 不支持的特性 解决oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Z异常 等等
在实际应用中,为了提高性能和资源利用率,通常会使用连接池(如C3P0、HikariCP、Apache DBCP等),预先创建并管理一组数据库连接,避免频繁地创建和关闭连接。 7.事务处理: JDBC支持事务管理,通过...
问题是这样的…我在VS2008直接运行打开网页,可以连接数据库…但通过输入地址,也可以打开网页,但涉及数据库就出问题… 无法打开登录所请求的数据库 “TakeClass”。登录失败。 用户 ‘2D2727E2578F446\ASPNET’ 登录...