Play 2.7 Databases broken out of the box

Based on the documentation here: https://www.playframework.com/documentation/2.7.x/ScalaDatabase

Step 1. use sbt new to create a new play 2.7 application
Step 2. copy the default.db {} config block seetting url, username, password, driver in your application.conf
Step 3. in your default HomeController get an injected Database using dependency injection like advertised (db :Database)
Step 4. use db.withConnection {} in an Action to do something
Step 5. Run program, observe it working and interacting with database.
Step 6. Come back 30 minutes later, observe it failing to get any connections, even though the app isn’t supposed to do any management of database connections and it’s all supposed to be handled itself.

Tested with mariadb and sqllite.

When you say it is failing to get connections, you mean it is failing to retrieve a connection from the pool or is it failing to connect to the database? Are the databases configured to end idle connections? Are there any logs on the database server showing that the connection was reset?

Anyway, these are things that Play cannot predict for all applications. So, if what is happening is a timeout on the database server, you should configure the pool to recycle the connections. See idleTimeout, maxLifetime and other configurations available here: https://github.com/brettwooldridge/HikariCP#frequently-used

Best.