Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marked as broken because of SQLSTATE(08S01), ErrorCode(0) #1246

Closed
Zhangjk2012 opened this issue Sep 28, 2018 · 2 comments

Comments

@Zhangjk2012
Copy link

commented Sep 28, 2018

Environment

HikariCP version: 3.2.0
JDK version     : 1.8.0_181-b13
Database        : MySQL
Driver version  : 5.1.46

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 13,529 milliseconds ago. The last packet sent successfully to the server was 13,529 milliseconds ago.

I have been inserting data into the database, this error has occurred in the middle.

HikariConfig cfg = new HikariConfig(); cfg.setAutoCommit(false); cfg.setConnectionTimeout(2000); cfg.setJdbcUrl(config.getUrl()); cfg.setDriverClassName("com.mysql.jdbc.Driver"); cfg.setUsername(config.getUser()); cfg.setPassword(config.getPassword()); cfg.setMaximumPoolSize(config.getPoolSize()); cfg.setPoolName(config.getPoolName()); cfg.addDataSourceProperty("characterEncoding", "utf8"); cfg.addDataSourceProperty("useUnicode", true); cfg.addDataSourceProperty("cachePrepStmts", true); cfg.addDataSourceProperty("prepStmtCacheSize", 250); cfg.addDataSourceProperty("useServerPrepStmts", true);
do i need to set the idleTimeout and minimumIdle properties?

@brettwooldridge

This comment has been minimized.

Copy link
Owner

commented Sep 30, 2018

maxLifetime is more important. Try setting it to half ita current value (from 30min to 15min). minimumIdle and IdleTimeout should not matter. You want to try to ensure that HikariCP kills connections before the DB does.

@Zhangjk2012

This comment has been minimized.

Copy link
Author

commented Oct 1, 2018

OK. ths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.