JDBC Pool Generator

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&amp;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.