Page 1 of 1

set max alive connection in connection pool

Posted: Mon Apr 21, 2014 5:22 am
by prabhat.kataria
I am using broadleaf demo site with tomcat server. Although i can run it with default settings, i am looking for a way to set max active connection in connection pool. I tried to change "maxActive" attribute of Resource tag in context.xml which gave me exactly same number of active connections that i set in "maxActive" at the time of application startup.

But when i visit any page, say home page, the number of live connections shots up drastically which stays live(in sleep mode) untill the application is stopped. Is there default number of active connections configured in hibernate code? If so, is there any way by which i can set the max connection to 20(for assumption)?

Re: set max alive connection in connection pool

Posted: Tue Apr 22, 2014 12:25 pm
by phillipuniverse
Which JDBC connection pool are you using?

Re: set max alive connection in connection pool

Posted: Tue Apr 22, 2014 2:18 pm
by prabhat.kataria
I have not used any different connection pool from my side. Its just that while configuring demo site in tomcat I copied contents from context.xml inside META-INF to context.xml inside tomcat installation, like the one below:

Code: Select all

<Resource name="jdbc/web"
              auth="Container"
              type="javax.sql.DataSource"
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
              testWhileIdle="true"
              testOnBorrow="true"
              testOnReturn="false"
              validationQuery="SELECT 1"
              timeBetweenEvictionRunsMillis="30000"
              maxActive="15"
              maxIdle="10"
              minIdle="5"
              removeAbandonedTimeout="60"
              removeAbandoned="false"
              logAbandoned="true"
              minEvictableIdleTimeMillis="30000"             
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
              username="${database.user}"
              password="${database.password}"
              driverClassName="${database.driver}"
              url="${database.url}"/>