Why does my Tomcat only open 8 JDBC connections

后端 未结 2 899
再見小時候
再見小時候 2020-12-11 09:35

When setting up the database connections in Tomcat 8, for some reason Tomcat is not following what I configured in the context.xml, with as result that I run out of connecti

2条回答
  •  萌比男神i
    2020-12-11 10:17

    By default (ie if not setting the factory setting of your ressource), tomcat7 uses commons dbcp1.

    Tomcat also provides an alternate pool implementation (the tomcat jdbc connection pool) that you can use by setting factory=org.apache.tomcat.jdbc.pool.DataSourceFactory on your ressource

    Tomcat8 uses commons dbcp2 by default, which has different names for some very important configuration parameters ( see https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling ) as dbcp1 (and the tomcat jdbc connection pool, because it mostly has the same configuration options as commons dbcp1).

    So basically, before tomcat8, you didn't have to pay attention to which connection pool you were using because of the configuration compatibilty. With tomcat8, you have to pay attention.

    Tomcat connection pool documentation: https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html

    Default commons dbcp2 documentation: https://tomcat.apache.org/tomcat-8.0-doc/jndi-resources-howto.html#JDBC_Data_Sources

提交回复
热议问题