I am trying to understand a specific scenario in database connection pooling. Any pointers on this will be very helpful.
Setup :
- Tomcat webserver
- MySQL Server (max connections = 18)
Configuration of webapp :
The context.xml of the webapp has these parameters for the database connection pool :
<Context path=...
<Resource name=... maxActive="20" maxIdle="18"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
validationQuery="select 1" testOnBorrow="true"... />
</Context>
Scenario :
The webapp opens and closes a lot of connections. However, the pool holds on to 18 of them (as maxIdle=18) when the webapp is not transacting any more with the dB.
Now at this point of time, a separate Pure Java standalone application requests for a database connection. How will the MySQL server respond?
- Will it provide a connection by closing an idle connection being held by the pool?
- Will it refuse a connection as maximum number of dB connections are already open (being held by the pool)
If I am not clear with the scenario, please let me know, and I will clarify further.
Cheers, Rohitesh