dbcp释放不了mysql链接_spring dbcp连接不释放-问答-阿里云开发者社区-阿里云
问题描述
这个spring配置,在使用过程中,基本上没插入200条数据后,通过mysql或netstat就可看到数据库连接达到10个,
并且mysql里面全部都是sleep状态。连接并没有释放,在等几十条后就出现异常。
dbcp配置
spring 注解事务
以下为stack信息
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, cause: Timeout waiting for idle object, cause: Timeout waiting for idle object
### The error may exist in configure/mybatis/User.xml
### The error may involve novel.Novel_read
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, cause: Timeout waiting for idle object, cause: Timeout waiting for idle object
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62) ~[mybatis-3.2.3.jar:3.2.3]
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) ~[mybatis-spring-1.2.1.jar:1.2.1]
... 45 common frames omitted
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, cause: Timeout waiting for idle object, cause: Timeout waiting for idle object
mysql状态采样(其余一样,共10个)
| 3 | root | localhost:34779 | test_db | Sleep | 659 | | NULL |
网络状态采样(其余一样,共10个)
tcp 0 0 ::ffff:127.0.0.1:34941 ::ffff:127.0.0.1:3306 ESTABLISHED 23223/java
使用c3p0和tomcat连接池均测试过,问题依旧存在。
c3p0配置如下:
软件版本
mysql版本5.6.14
mysql-connector 5.1.22
执行的插入SQL
insert into LT_USER (
NAME,
DESCN,
IMG,
CATEGORY_ID,
IS_FINISH,
CREATE_DATE,
STATUS
) values (
#{name, jdbcType=VARCHAR},
#{descn, jdbcType=VARCHAR},
#{img, jdbcType=VARCHAR},
#{categoryId, jdbcType=NUMERIC},
#{isFinish},
#{createDate},
#{status}
)
@Repository
public class UserDao extends SqlSessionDaoSupport {
public long create(final String sqlId, final Parameter parameter) {
return this.getSqlSession().insert(sqlId, parameter.getCriteria());
}
}
事务配置
dbcp释放不了mysql链接_spring dbcp连接不释放-问答-阿里云开发者社区-阿里云相关推荐
- mysql查询关键字报错_mysql中in关键字查询时的问题? 400 报错-问答-阿里云开发者社区-阿里云...
之前也遇到过类似的问题,就是in关键字指定的范围没有数据,会出错######改用exists呢######不行######用join 链接查询过滤一下算了######我是这么做了,但是现在我就想知道, ...
- canal同步mysql到kafka_使用Canal同步MySQL数据到Kafka 得到的数据中sql字段无值-问答-阿里云开发者社区-阿里云...
这个应该跟你的binlog记录模式有关系,binlog有3中模式,ROW(行模式), Statement(语句模式), Mixed(混合模式)三种模式的用法如下: ROW(行模式):记录那条数据修改了 ...
- coba mysql_在Android Studio中将数据从MySQL数据库显示到TextView中-问答-阿里云开发者社区-阿里云...
我是新手,Android Studio我想将数据库(我使用MySQL)中的数据显示到中TextView.我也使用Button和RadioButton.单击按钮后,数据将显示在中TextView.这是我 ...
- mysql linux改user_linux mysql误修改user表导致无法root用户登录,求大神帮助。-问答-阿里云开发者社区-阿里云...
linux mysql误修改user表导致无法root用户登录,急救!!! mysql> select user,host,password from user; user host passw ...
- bae 3.0 mysql_bae3.0 mysql 有时报错?报错-问答-阿里云开发者社区-阿里云
Jfinal 用的MySQL的数据源:MysqlDataSource ds = new MysqlDataSource(); Config: MysqlDataSource ds = new Mysq ...
- liunx导出mysql慢查询日志查看_查看 MySQL 慢查询日志文件-问答-阿里云开发者社区-阿里云...
查看 MySQL 是否启用了慢 SQL 查询: 查看慢 SQL 日志是否启用. mysql> show variables like 'log_slow_queries'; +--------- ...
- mysql hang住_mysql 5.7不定期的hang住重启-问答-阿里云开发者社区-阿里云
线上一台mysql 5.7.17版本实例,系统centos 6.4 ,96G内存,SSD磁盘,buffer pool 60G,buffer pool instance 8,24 CPU.实例访问情况如 ...
- mysql总是出现-_mysql 总是莫名其妙的关闭:报错
-问答-阿里云开发者社区-阿里云...
CentOS MYSQL 5.6不知道为什么,MYSQL总是莫名其妙的被关闭,然后网页提示 Connect Error (1045)Access denied for user 'root'@'172 ...
- mysql 提高事物效率_怎么提高向mysql中插入数据的效率-问答-阿里云开发者社区-阿里云...
String[] filelist = file.list(); for(String filename : filelist){ BufferedReader br = new BufferedRe ...
最新文章
- centos7 systemctl 管理 mysql
- 人是要有一点精神的!
- windows平台下安装Mysql8.0.20版本
- axios delete有请求体吗_封装 axios 取消重复请求
- centos 6 x64 mysql_CentOS 6.x版本升级Mysql
- ubuntu 重定向
- Spring中的@scope注解
- IOS UIViewController API,生命周期详解
- 帝国cms数据库php调用tag,帝国CMS列表内容模板调用TAG的两种方法
- screw-plus实现php代码安全
- java 后台 小程序微信支付
- ICLR'22 | 基于可微分提示的语言模型少样本微调方法
- 形式语言与自动机第三课
- Qt信号与槽机制原理
- [人月神话]读书笔记---人月神话的观点:是与非
- C++ 虚函数实现:虚函数表 虚表指针
- 基于面板数据的熵值法介绍与实现
- python使用RSA加密算法
- 大白话5分钟带你走进人工智能-第33节神经网络和神经元概念(1)
- kingbase之ksql命令工具