I want to know if my understanding of the Tomcat Connection pool lifecycle is correct.
For example, I have the following settings:
<Resource name="jdbc/appname" auth="Container"
type="javax.sql.DataSource" maxActive="100"
maxIdle="30" maxWait="1000"
username="username"
initialSize = "5"
password="password"
driverClassName="jdbc.driver.name"
url="jdbc:protocol://hostname:port/dbname"/>
When my application is deployed it has 5 connections(initial size), when all these connections are busy tomcat create and add to pool a new connection(6), this new connections limit are maxActive(100) and when 101 requests are coming, tomcat will wait 1000 ms(maxWait) and then throw TimeOutException. In some period of time only 40 connections are busy, and when one of them is free it will be destroyed because pool almost has 30(maxIdle) free connections. Am I right?
And if I am, then what is the purpose of setting maxIdle and maxActive to different values?