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
![](https://i-blog.csdnimg.cn/direct/1f08cce7033242f087d67aa48aeafeda.png)
mysql 链接字符串没有 &connectTimeout=600000&socketTimeout=600000 导致查询超过10秒就报错了
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
![](https://i-blog.csdnimg.cn/direct/5e555bb09e3c4c609b2529b51ca51e58.png)
postgresql是同样的问题,报错不一样,也是10秒超时。postgresql链接字符串加了&connectTimeout=600000&socketTimeout=600000这个不生效。发现druid这个玩意也是个坑
不管datasource.setSocketTimeout()给多少值根本就不生效 在datasource.getConnection()的时候就会更新成 10000
![](https://i-blog.csdnimg.cn/direct/c2504c74f6904b9080125f9179b4ea9d.png)
![](https://i-blog.csdnimg.cn/direct/51dbdb040ec74fd2b9ca06e47652c68f.png)
最后用 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);