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);