Symptoms:
You have a Java web application (Java Web, Grails, Spring, etc...) and it is failing to start stating that the maximum number of connections to the database has been exceeded.
This error happens when your application exceeds the maximum number of connections allowed by your database provider. This prevents further connections from being established.
There are a few ways to resolve this issue.
1. If you are using Spring Boot, please see this article Connection pool warning message "maxIdle is larger than maxActive, setting maxIdle to: 4" seen in PCF-deployed Spring app
2. From the service side, you can upgrade your service instance so that it supports more simultaneous connections.
3. From the application side, you can define some limits on your DataSource/connection pool. To do this, you'll need to use the manual service configuration option which is described in the documentation here or this KB article.