Chris Stewart
Chris Stewart

Reputation: 1679

Slick cannot change HikariCP connectionTimeout

I'm trying to change the maximumPoolSize and connectionTimeout parameters for HikariCP for my slick database, here is my settings inside of application.conf

testNet3DatabaseUrl {
  dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
  driver = "slick.driver.PostgresDriver$"
  db {
    driver="org.postgresql.Driver"
    url="jdbc:postgresql://localhost:5432/bitcoins-spv-node-testnet3"
    user="bitcoins-spv-node-admin"
    password=""
    queueSize=5000
    numThreads=8
  }
  connectionTimeout=3000
  maximumPoolSize=100
}

Now, when I try and use my database, I get an error saying Exception: java.sql.SQLTimeoutException: Timeout after 1000ms of waiting for a connection. Why isn't the timeout being set to 3000ms like I have specified in my application.conf?

Upvotes: 2

Views: 3279

Answers (1)

Chris Stewart
Chris Stewart

Reputation: 1679

This was a stupid mistake on my part, here is what the settings need to be:

testNet3DatabaseUrl {
  dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
  driver = "slick.driver.PostgresDriver$"
  db {
    driver="org.postgresql.Driver"
    url="jdbc:postgresql://localhost:5432/bitcoins-spv-node-testnet3"
    user="bitcoins-spv-node-admin"
    password=""
    queueSize=5000
    numThreads=8
    connectionTimeout=3000
    maximumPoolSize=100
  }
}

You can see how this is parsed here: https://github.com/slick/slick/blob/master/slick-hikaricp/src/main/scala/slick/jdbc/hikaricp/HikariCPJdbcDataSource.scala#L43-L55

Upvotes: 7

Related Questions