如何在 Slick-HikariCP 中设置配置参数
How to Set config params in Slick-HikariCP
我正在使用 Slick 和 Mysql。收到错误:
Failed to validate connection com.mysql.jdbc.JDBC4Connection@58e7cfcd (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value."
我明白这个问题,但不知道如何在 slick on config 中设置 maxLifetime。这是我的配置:
mysqldb {
driver = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306"
user = root
password = root
connectionTimeout = 10000
queueSize = 50000
minConnections = 20
maxConnections = 40
numThreads = 40
}
如有任何帮助,我们将不胜感激。
你可以在数据库配置下设置:
mysqldb {
driver = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306"
user = root
password = root
connectionTimeout = 10000
queueSize = 50000
minConnections = 20
maxConnections = 40
numThreads = 40
idleTimeout = 85000 // should be less than maxLifetime
maxLifetime = 90000 //time is in millsecods and should be less than database wait_timeout
}
我正在使用 Slick 和 Mysql。收到错误:
Failed to validate connection com.mysql.jdbc.JDBC4Connection@58e7cfcd (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value."
我明白这个问题,但不知道如何在 slick on config 中设置 maxLifetime。这是我的配置:
mysqldb {
driver = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306"
user = root
password = root
connectionTimeout = 10000
queueSize = 50000
minConnections = 20
maxConnections = 40
numThreads = 40
}
如有任何帮助,我们将不胜感激。
你可以在数据库配置下设置:
mysqldb {
driver = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306"
user = root
password = root
connectionTimeout = 10000
queueSize = 50000
minConnections = 20
maxConnections = 40
numThreads = 40
idleTimeout = 85000 // should be less than maxLifetime
maxLifetime = 90000 //time is in millsecods and should be less than database wait_timeout
}