JDBC Connection Pool Configuration Generator
Production-hardened Tomcat DBCP2 / HikariCP data source fragments with leak detection and abandoned connection reclamation.
Interactive DataSource Generator (context.xml / server.xml)
<!-- PostgreSQL Production DataSource -->
<Resource name="jdbc/ProductionDB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://db.corp.internal:5432/myapp_db?ssl=true&sslmode=verify-full"
username="app_user"
password="StrongSecretPassword123"
initialSize="10"
maxTotal="100"
maxIdle="30"
minIdle="10"
maxWaitMillis="10000"
testOnBorrow="true"
validationQuery="SELECT 1"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="30000"
removeAbandonedOnBorrow="true"
removeAbandonedTimeout="60"
logAbandoned="true" />
Connection Leak Protection:
removeAbandonedOnBorrow="true" and removeAbandonedTimeout="60" automatically closes and reclaims SQL connections that unclosed application code abandoned for over 60 seconds.