I want to make the connection alive from tomcat to the db server. As of now connection is getting closed / terminating might be due to network or idle connection.
Following is my configuration. <Resource name="jdbc/DB_NAME" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://IP:PORT/DB_NAME" username="" password="" maxActive="100" maxIdle="20" maxWait="30000" removeAbandoned="true" removeAbandonedTimeout="120" logAbandoned="true" /> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> I want to ensure that my connection should be alive and henceforth, I have added following parameter in above Resource configuration. validationQuery="SELECT 1" testOnBorrow=true However, after searching many forum says that you should add below parameters too. Please advise on it. testOnReturn= testWhileIdle= minEvictableIdleTimeMillis timeBetweenEvictionRunsMillis