- 浏览: 495118 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (563)
- 工作经验 (12)
- 数据库 (13)
- Servlet (10)
- Struts2 (1)
- Spring (25)
- Eclipse (5)
- Hibernate (5)
- Eclips (8)
- HTTP (7)
- J2EE (21)
- EHcache (1)
- HTML (11)
- 工具插件使用 (20)
- JPA (2)
- 杂谈 (17)
- 数据结构与算法 (3)
- Cloud Foundry (1)
- 安全 (10)
- J2SE (57)
- SQL (9)
- DB2 (6)
- 操作系统 (2)
- 设计模式 (1)
- 版本代码管理工具 (13)
- 面试 (10)
- 代码规范 (3)
- Tomcat (12)
- Ajax (5)
- 异常总结 (11)
- REST (2)
- 云 (2)
- RMI (3)
- SOA (1)
- Oracle (12)
- Javascript (20)
- jquery (7)
- JSP自定义标签 (2)
- 电脑知识 (5)
- 浏览器 (3)
- 正则表达式 (3)
- 建站解决问题 (38)
- 数据库设计 (3)
- git (16)
- log4j (1)
- 每天100行代码 (1)
- socket (0)
- java设计模式 耿祥义著 (0)
- Maven (14)
- ibatis (7)
- bug整理 (2)
- 邮件服务器 (8)
- Linux (32)
- TCP/IP协议 (5)
- java多线程并发 (7)
- IO (1)
- 网页小工具 (2)
- Flash (2)
- 爬虫 (1)
- CSS (6)
- JSON (1)
- 触发器 (1)
- java并发 (12)
- ajaxfileupload (1)
- js验证 (1)
- discuz (2)
- Mysql (14)
- jvm (2)
- MyBatis (10)
- POI (1)
- 金融 (1)
- VMWare (0)
- Redis (4)
- 性能测试 (2)
- PostgreSQL (1)
- 分布式 (2)
- Easy UI (1)
- C (1)
- 加密 (6)
- Node.js (1)
- 事务 (2)
- zookeeper (3)
- Spring MVC (2)
- 动态代理 (3)
- 日志 (2)
- 微信公众号 (2)
- IDEA (1)
- 保存他人遇到的问题 (1)
- webservice (11)
- memcached (3)
- nginx (6)
- 抓包 (1)
- java规范 (1)
- dubbo (3)
- xwiki (1)
- quartz (2)
- 数字证书 (1)
- spi (1)
- 学习编程 (6)
- dom4j (1)
- 计算机系统知识 (2)
- JAVA系统知识 (1)
- rpcf (1)
- 单元测试 (2)
- php (1)
- 内存泄漏cpu100%outofmemery (5)
- zero_copy (2)
- mac (3)
- hive (3)
- 分享资料整理 (0)
- 计算机网络 (1)
- 编写操作系统 (1)
- springboot (1)
最新评论
-
masuweng:
亦论一次OutOfMemoryError的定位与解错 -
变脸小伙:
引用[color=red][/color]百度推广中运用的技术 ...
Spring 3 mvc中返回pdf,json,xml等不同的view -
Vanillva:
不同之处是什么??
Mybatis中的like查询 -
thrillerzw:
转了。做个有理想的程序员
有理想的程序员必须知道的15件事 -
liujunhui1988:
觉得很有概括力
15 个必须知道的 Java 面试问题(2年工作经验)
c3p0数据库连接池不能取到连接An attempt by a client to checkout a Connection has timed out
- 博客分类:
- 数据库
源:https://blog.csdn.net/attilax/article/details/17770113
评:
paip.提升稳定性---c3p0数据库连接池不能取到连接An attempt by a client to checkout a Connection has timed out
作者Attilax 艾龙, EMAIL:1466519819@qq.com
来源:attilax的专栏
地址:http://blog.csdn.net/attilax
最开始,卡死,不动了,,使用jprofile, thread dump...原来是在getconn()在wait..默认
添加设置
# 当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
# SQLException,如设为0则无限期等待。单位毫秒,默认为0
c3p0.checkoutTimeout=10000
此时,取得conn不到报错。c3p0连接错误 An attempt by a client to checkout a Connection has timed out
----根本原因: 池中的连接已经被全部使用完了..达到了最大maxconn...从而导治这个错误...
----其他原因:忘记close conn,或者异常了而没有close conn,没有释放conn从池中。。...导治池中的conn满的了...
、、、、、解决方法:
a.适当加大maxPoolSize和minPoolSize ,可以大大缓解这种情况。。
c3p0.maxPoolSize=5000
c3p0.minPoolSize=10
b.检测代码 close conn..释放conn...当然这个总是有遗漏.最小化这个影响就好..
c.自动超时回收Connection (强烈推荐)
c3p0.unreturnedConnectionTimeout=25
default : 0 单位 s
为0的时候要求所有的Connection在应用程序中必须关闭。如果不为0,则强制在设定的时间到达后回收
Connection,所以必须小心设置,保证在回收之前所有数据库操作都能够完成。这种限制减少Connection未关闭
情况的不是很适用。为0不对connection进行回收,即使它并没有关闭。
d.配置超时自动断开conn (推荐)
c3p0.maxIdleTimeExcessConnections=20
c3p0.maxConnectionAge=20
default : 0 单位 s
配置连接的生存时间,超过这个时间的连接将由连接池自动断开丢弃掉。当然正在使用的连接不会马上断开,而是等待
它close再断开。配置为0的时候则不会对连接的生存时间进行限制。
e.最后,show full processlist ..查看db conn数,,稳定后走ok...否则适当调整以上参数..
------------还有一种说法。c3p0.max_statements 设置成0 可以解决。时间忙,没有验证。。。
网上很多说是C3P0的bug问题。c3p0在同时关闭statement和connection的时候,或者关闭他们之间的时间很短的时候,有时候connection并没有被关闭,因为有些preparedstatement还在被cached住。这样就会有很多connection并没有真正的被关闭,连接池的连接都给耗尽了,就会产生上面的异常。解决的方案就是把缓存关闭也就是把c3p0.max_statements 设置成0,这样就不会有缓存的preparedstatement,而设置的c3p0.idle_test_period又小于c3p0.timeout,这样的设置应该没有什么问题了。
评:
paip.提升稳定性---c3p0数据库连接池不能取到连接An attempt by a client to checkout a Connection has timed out
作者Attilax 艾龙, EMAIL:1466519819@qq.com
来源:attilax的专栏
地址:http://blog.csdn.net/attilax
最开始,卡死,不动了,,使用jprofile, thread dump...原来是在getconn()在wait..默认
添加设置
# 当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
# SQLException,如设为0则无限期等待。单位毫秒,默认为0
c3p0.checkoutTimeout=10000
此时,取得conn不到报错。c3p0连接错误 An attempt by a client to checkout a Connection has timed out
----根本原因: 池中的连接已经被全部使用完了..达到了最大maxconn...从而导治这个错误...
----其他原因:忘记close conn,或者异常了而没有close conn,没有释放conn从池中。。...导治池中的conn满的了...
、、、、、解决方法:
a.适当加大maxPoolSize和minPoolSize ,可以大大缓解这种情况。。
c3p0.maxPoolSize=5000
c3p0.minPoolSize=10
b.检测代码 close conn..释放conn...当然这个总是有遗漏.最小化这个影响就好..
c.自动超时回收Connection (强烈推荐)
c3p0.unreturnedConnectionTimeout=25
default : 0 单位 s
为0的时候要求所有的Connection在应用程序中必须关闭。如果不为0,则强制在设定的时间到达后回收
Connection,所以必须小心设置,保证在回收之前所有数据库操作都能够完成。这种限制减少Connection未关闭
情况的不是很适用。为0不对connection进行回收,即使它并没有关闭。
d.配置超时自动断开conn (推荐)
c3p0.maxIdleTimeExcessConnections=20
c3p0.maxConnectionAge=20
default : 0 单位 s
配置连接的生存时间,超过这个时间的连接将由连接池自动断开丢弃掉。当然正在使用的连接不会马上断开,而是等待
它close再断开。配置为0的时候则不会对连接的生存时间进行限制。
e.最后,show full processlist ..查看db conn数,,稳定后走ok...否则适当调整以上参数..
------------还有一种说法。c3p0.max_statements 设置成0 可以解决。时间忙,没有验证。。。
网上很多说是C3P0的bug问题。c3p0在同时关闭statement和connection的时候,或者关闭他们之间的时间很短的时候,有时候connection并没有被关闭,因为有些preparedstatement还在被cached住。这样就会有很多connection并没有真正的被关闭,连接池的连接都给耗尽了,就会产生上面的异常。解决的方案就是把缓存关闭也就是把c3p0.max_statements 设置成0,这样就不会有缓存的preparedstatement,而设置的c3p0.idle_test_period又小于c3p0.timeout,这样的设置应该没有什么问题了。
发表评论
-
The last packet successfully received from the server was 179 milliseconds ago.
2018-05-22 14:59 847源:http://elf8848.iteye.com/blog ... -
RAID详解[RAID0/RAID1/RAID10/RAID5]
2018-03-26 16:30 464源:http://blog.chinaunix.net ... -
Oracle模糊查询之(3.2从使用函数和sql语法角度来提高模糊查询效率 二)ORACLE中Like与Instr模糊查询性能大比拼
2016-03-24 16:16 610源:http://blog.csdn.net/haiross/ ... -
Oracle模糊查询之(2.如何测试模糊查询的时间及使用是否使用索引)反向索引与模糊查询
2016-03-24 16:05 687源:http://blog.csdn.net/haiross/ ... -
mysql创建用户
2013-05-21 23:37 723源:http://persistc.iteye.com/bl ... -
PostgreSQL 9.3 新特性预览 —— JSON 操作
2013-05-08 19:09 1164源:http://www.oschina.net/quest ... -
数据库行列转换
2013-03-28 19:32 893源:http://wenku.baidu.com/view/ ... -
多表连接原理
2013-03-09 14:28 1026源: 评: 学习数据 ... -
DB2 JDBC Driver
2013-03-05 20:05 856源:http://www.oschina.net/p/db2 ... -
mysql数据库备份及恢复命令mysqldump,source的用法
2013-02-03 21:26 990还原一个数据库:mysql -h localhost -u ... -
数据库视图有什么作用?
2013-01-15 19:22 1399源:http://bbs.csdn.net/topic ... -
15 个必须知道的 Java 面试问题(2年工作经验)
2013-01-15 19:19 1515源:http://www.oschina.net/quest ...
相关推荐
DataSourceUtils.java c3p0数据库连接
mysql密码过期了,今天遇到了连接mysql,总是连接不上去, 错误现象1: An attempt by a client to checkout a Connection has timed out 第一次出现连接超时错误,第一反应是去修改cpool.checkoutTimeout参数为...
An attempt at a C++ tutorial.
如何解决恢复DB2数据库的32位实例下的压缩备份到64位实例时遇到的SQL2570N错误?
Hence, it becomes possible for the attacker to issue a command to all the nodes, that target a single node (for example, all nodes in the botnet might be commanded by the attacker to send a TCP SYN ...
By supplying a DSN entry, it will attempt to connect to that database and list all the tables in it. When you click on a table, it lists all <END><br>38,3a.zip An Inventory System, you can add, ...
The Kerberos protocol uses strong cryptography so that a client can prove its identity to a server (and vice versa) across an insecure network connection. After a client and server has used Kerberos ...
This second edition has given an opportunity to update the text and to take account of developments in a very rapidly changing field. It has also permitted several major revisions of the text. The ...
- Updated license management, in an attempt to remove a rare crash on startup. Release 5.3 build 1012.0002 WIN32 release 31 October 2007 - New build of Rebooter (64-bit Windows correction). - ...
For example, suppose a transaction scanned a page using an S lock and then subsequently decided to perform a row level update. The row would obtain an X lock, but now the page would require an IX ...
new ʻvisualizationsʼ are an attempt to explain the underlying information with a powerful visual impact. They take complex ideas and distil them into beautiful graphics revealing the ...
130 0×00000082 Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O. 131 0×00000083 尝试将档案指针移至档案开头之前。 132 0×00000084 无法在指定的装置或档案...
一行不能超过256个字符;大小写有区分。 二、特殊字符含义 文件名以“.”开头的都是隐藏文件/目录,只需在文件/目录名前加“.”就可隐藏它。 ~/ 表示主目录。 ./ 当前目录(一个点)。 ../ 上一级目录(两个...
This development was the natural result of the attempt by the producers to make themselves stand out among increasing competition by developing the most user friendlylanguages and tools.
在分页有到Cursor(游标)取游标下一个值cursor.moveToNext(),用游标对象接数据 "select * from person limit ?,?" person不能加上where 关键字 4.在删除注意:sb.deleteCharAt(sb.length() - 1); 四、...
The economic load dispatch plays an important role in the operation of power ... Here, an attempt has been made to find out the minimum cost by using PSO using the data of three and six generating units
You can send messages with a client/server type setup.<END><br>57 , al40.zip Apparently, if you use AOL to connect to the Internet and you do not touch it for 45 minutes it will timeout and drop ...
Windows XP Service pack 2 introduced some new security measures in an attempt to prevent the use of overwritten heap headers to do arbitrary byte writing. This method of exploiting heap overflows, and...
If you attempt to access a reserved address that has not yet been committed (backed by memory or disk) you will cause an access violation. Committed Memory Committed pages are those pages that when ...