How to configure Play to being able to configure HikariCP via the hikaricp.properties file

703 views
Skip to first unread message

Benjamin Ellenberger

unread,
Jan 11, 2017, 7:50:36 AM1/11/17
to Play Framework

Hello everyone!


I am looking for a way to configure jdbc in play a bit more than possible by the application.conf. I ported our application using play to the newest version (2.5.x) and learned that it now uses the HikariCP. We have been configuring jdbc to behave in a specific manner (batch writing etc.) and I see that HikariCP can configure jdbc via a properties file. It seems that for a certain old Hikari plugin for play it was possible to set the file using the following setting in the application.conf:

db.default.hikaricp.file="conf/hikaricp.properties"

How can this be achieved now that HikariCP is the default connection pool and the plugins are not necessary anymore? Can I give a more specific configuration to the pool than just using the few options that are available to be used within the application.conf?

Thibault Meyer

unread,
Jan 11, 2017, 8:27:45 AM1/11/17
to Play Framework
Hi,

you can probably do this by adding and editing the file "conf/reference.conf"

Benjamin Ellenberger

unread,
Jan 11, 2017, 3:20:40 PM1/11/17
to Play Framework
Thanks for your answer. I am not sure what you mean. What I am referring to is for instance to enable batch writing in jdbc. This is not possible via the normal application.conf. Can you tell me how you would add this to reference.conf?

Marcos Pereira

unread,
Jan 23, 2017, 3:15:02 PM1/23/17
to play-fr...@googlegroups.com
Benjamin,

Following up the discussion at this issue: https://github.com/playframework/playframework/issues/6905

See this section of the configuration reference:


You can add specific data source configuration here, like this:

db {
  default {
    driver=com.mysql.jdbc.Driver
    url="jdbc:mysql://localhost/some_database"
    username=someuser
    password="a strong password"
    hikaricp {
      dataSource {
        cachePrepStmts=true
        prepStmtCacheSize=250
        prepStmtCacheSqlLimit=2048
      }
    }
  }
}

Hope this helps.

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/2b8641c2-deb3-4177-bea3-942f2b701ce0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcos Pereira
Software Engineer, Lightbend.com

Benjamin Ellenberger

unread,
Jan 24, 2017, 3:08:48 AM1/24/17
to Play Framework
Thank you very much! That was exactly what I was looking for for weeks!
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages