Reputation: 917
HikariCP is used in Slick 3 library for configuration of Connection Pool.
According to HikariCP Rapid-Recovery in order to be able "to recover from database restart or network partition events" its recommended to set socketTimeout as its disabled by default.
Question is how to setup socketTimeout in slick?
Upvotes: 2
Views: 1927
Reputation: 917
In application.conf add socketTimeout as part of JDBC URL
db {
profile = "slick.jdbc.MySQLProfile$"
db {
url = "jdbc:mysql://localhost:3306/dbname?socketTimeout=30000"
driver = com.mysql.cj.jdbc.Driver
user = "<user>"
password = "<password>"
}
}
From MySQL Connector/J 8.0 documentation
Configuration properties can be set in one of the following ways:
- Using the set*() methods on MySQL implementations of jdbc url java.sql.DataSource (which is the preferred method when using implementations of java.sql.DataSource)
- As a key-value pair in the java.util.Properties instance passed to DriverManager.getConnection() or Driver.connect()
- As a JDBC URL parameter in the URL
Upvotes: 3