I am currently developing a web application, using tomcat 9 and Postgres SQL 9.4, in the context.xml of the server conf folder create the following pool of connections.
<Resource name="jdbc/DBApp"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
auth="Container"
type="javax.sql.DataSource"
username="xxx"
password="xxx"
driverClassName="org.postgresql.Driver"
description="Base de datos de Eidyhealth"
url="jdbc:postgresql://localhost:5432/APP"
initialSize="5"
maxActive="10"
maxIdle="10"
minIdle="5"
suspectTimeout="60"
maxWait="60000"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
rollbackOnReturn="true"/>
However, when I start the tomcat and check the open connections in Postgres, I see 26 connections in the Idle state and when I run the application, the number goes up to 34.
What is the appropriate configuration in Tomcat 9 to ensure that only a maximum of 20 connections are created in the Postgres?
Thank you.