开发者社区> 问答> 正文

开发遇到的数据库连接池问题

在项目开发中遇到这样的问题
1
这是一个程序批量向数据库插入 一些用户
数据库是mysql
底层用的是数据库连接池 其中 datasource如下图所示
2
结果是 出现如下异常
()org.springframework.dao.DataAccessResourceFailureException: SqlMapClient operation; SQL [];
--- The error occurred in ibatis/secondary/sqlmap/task_otherthread.xml.
--- The error occurred while applying a parameter map.
--- Check the TaskOtherThreadDao.insertWoman-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 5,007 milliseconds ago. The last packet sent successfully to the server was 5,006 milliseconds ago.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ibatis/secondary/sqlmap/task_otherthread.xml.
--- The error occurred while applying a parameter map.
--- Check the TaskOtherThreadDao.insertWoman-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 5,007 milliseconds ago. The last packet sent successfully to the server was 5,006 milliseconds ago.
结果是数据库中已经插入了1些数据
我有两个疑问
疑问1:在出异常之前,这个插入操作是一直拿着 数据库连接池中的同一个链接吗?
疑问2: 就是怎么会出现以上这个链接失败的异常

展开
收起
落地花开啦 2016-02-13 10:21:52 3606 0
1 条回答
写回答
取消 提交回答
  • 1:不是;
    2:你看你的配置最大等待时间是1S,报错是链接失败,也告诉你,5s了没有接收服务端的消息,ibatis就会报这个错误,你检查下网络,我看你user都没设置属性,是有null的,不报错才怪呢!

    2019-07-17 18:41:46
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
2022 DTCC-阿里云一站式数据库上云最佳实践 立即下载
云时代的数据库技术趋势 立即下载
超大型金融机构国产数据库全面迁移成功实践 立即下载