1
votes

I'm trying to set up Slick as our DAO layer in our Play application. I have the following:

In my application.conf:

dbConfig {
  url = "jdbc:postgresql://localhost:5432/test"
  dataSourceClass = "org.postgresql.ds.PGConnectionPoolDataSource"
  properties = {
    databaseName = "mydb"
    user = "myuser"
    password = "secret"
  }
  numThreads = 10
}

Should I use PGSimpleDataSource instead of the PGConnectionPoolDataSource?

The documentation from Slick is not sufficient enough and it only confuses me.

The next question is, what is that I get from doing

Database.fromConfig("dbConfig")

is a Database which is of type DatabaseDef. Do I have to ask or create a session every time when I want to do some read, write in my tables?

Where did I say that I should use HikariCP as my connection pool implementation?

1
What version of Play do you use?Mon Calamari
I guess it is either 2.1 or 2.3joesan

1 Answers

1
votes

In version 2.4, HikariCP is shipped with Play Framework as default connection pool, meaning there is no any hassle with configuring the pool. I suggest you going to releases page and grabbing 2.4 (or release candidate).