mysql、postgresql、druid链接池踩坑记录

The last packet successfully received from the server wIs 10,010 milliseconds ago. The last packet sent successfully to the server was 10,010 milliseconds ago.### The error may exist in URL

mysql 链接字符串没有 &connectTimeout=600000&socketTimeout=600000 导致查询超过10秒就报错了

org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.

postgresql是同样的问题,报错不一样,也是10秒超时。postgresql链接字符串加了&connectTimeout=600000&socketTimeout=600000这个不生效。发现druid这个玩意也是个坑

复制代码
不管datasource.setSocketTimeout()给多少值根本就不生效 在datasource.getConnection()的时候就会更新成 10000 

最后用 HikariDataSource就没问题。

复制代码
HikariConfig config = new HikariConfig();
            config .setJdbcUrl(url);
            config .setUsername(username);
            config .setPassword(password);
            config .setDriverClassName(driverClass);

            // 设置连接池属性
            config.setMaximumPoolSize(10);
            config.setMinimumIdle(5);
            config.setIdleTimeout(30000);

            return new HikariDataSource(config);
相关推荐
幻风_huanfeng20 小时前
软考:高级软件架构师学习笔记----数据库
数据库·软考·系统架构师
衿心.20 小时前
Django TemplateDoesNotExist
数据库·django·sqlite
方便面不加香菜21 小时前
MySQL 复合查询
数据库·mysql
花花鱼21 小时前
MySQL Illegal mix of collations 全解|字符集与排序规则冲突原理、分层排错、通用解决方案(适配5.7/8.0迁移)
数据库·mysql
Wang's Blog21 小时前
PostgreSQL笔记37:数据库性能瓶颈排查方法论与工具链
数据库·笔记·postgresql
Wang's Blog21 小时前
PostgreSQL笔记23:Checkpoint机制与脏页处理深度解析
笔记·postgresql
Lyyaoo.1 天前
Spring Boot Validation 声明式参数校验
spring boot·后端·mysql
kUhzIPVBnE1 天前
fpga can控制器Verilog,节省你的电路板面积 ...altera、xilinx工程...
postgresql
oradh1 天前
Oracle闪回技术操作总结
数据库·oracle·oracle闪回技术操作总结·oracle闪回·flashback技术
南城以南溫暖如初1471 天前
外卖CPS实战指南:从技术选型到运营落地全流程解析
java·spring boot·mysql·架构·vue