2
votes

I'm trying for the first time to setup a Play project and I already got stuck! In fact when I run the application I get this exception as soon as I try to call "http://localhost:9000/":

java.sql.SQLTransientConnectionException: db - Connection is not available, request timed out after 1004ms

I also get this in the logs every 2 seconds:

[error] c.z.h.p.PoolBase - db - Failed to execute isValid() for connection, configure connection test query. (Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.)

This is what I did:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Code side I just created a class DAO to add, remove and list the records for the user table and called the "add" method from the controller.

I hope I gave enough details

2
This sounds like a connection leak! Can you also show us how you use the DB Connection object to make the database calls? - joesan
Thanks for the answer. I added the part where I do the calls to the db - Mirko
Did you try logging the calls from Slick? logger.scala.slick=DEBUG - joesan
I tried now but nothing changed because I noticed that the exception is triggered before everything, even before the controller is called - Mirko
Can you perhaps avoid using play-slick library? Have a look at my answer! - joesan

2 Answers

6
votes

I found the final solution using the Play Slick library, configuring it in this way:

enter image description here

enter image description here

enter image description here

You can see the versions of Slick and Play used in the PlaySlick library from the table in this page

2
votes

I would try avoiding using the Play-Slick library and use the Slick libraries as such! For some examples on how this could be done, have a look here in one of my projects:

https://github.com/joesan/plant-simulator/tree/master/app/com/inland24/plantsim/services/database

Over there I have used Slick as a dependency to my project directly and I'm not using the play-slick dependency.