Rahul Rastogi
Rahul Rastogi

Reputation: 4698

how to create connection pool in scala using mysql with play 2.2

i am using mysql in scala with play 2.2 and want to create a connection pool. I am recently find myself unable to get the code of creating connection pool. help...

Upvotes: 1

Views: 1594

Answers (1)

johanandren
johanandren

Reputation: 11479

As Ivan Meredith said, play already comes with a connection pool, (bonecp by default), so if you configure database access as described in the play docs (http://www.playframework.com/documentation/2.2.x/ScalaDatabase) the connections from withConnection or withTransaction will come from the connection pool.

If you want to fine-tune the connection pool almost everything seems to be supported in the config but I cannot find any docs on it so you might have to dive into the sources to find the configuration file property names.

Default configuration in Play 2.2 creates 1 partition with 5-30 connections.

https://github.com/playframework/playframework/blob/master/framework/src/play-jdbc/src/main/scala/play/api/db/DB.scala

Upvotes: 2

Related Questions