tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <>
Subject Re: Reg: Connection pool stats
Date Thu, 07 Nov 2013 13:48:54 GMT
On Nov 7, 2013, at 2:07 AM, Anu Prab <> wrote:

> Hi,
> I am using Tomcat 7.0.42 and Tomcat jdbc pool.

Just to be perfectly clear, how are you using this?  With a <Resource/> tag in your
Tomcat configuration or are you creating the pool in your code?  Either way, include the necessary
config or code which shows how you've defined the pool.

> Once the pool is created
> with the default configuration, I obtained few connections from this pool.

Again, how are you obtaining connections?  Is this through JNDI or through direct access by
code in your application?  An example would be helpful.

> But after certain amount of time, dataSource.getSize() shows the size as 0!

How are you determining this?  Are you looking at it in a debugger?  Do you have a direct
reference to the data source in your code?  If so, can you show an example?

As a note, when used in Tomcat (i.e. you've configured it with a <Resource/> tag) you
should use JMX to monitor pool statistics.  Of course you can do this if you manually create
the pool (like in a public static void main app), but you'll need to make sure JMX is correctly
setup in your application.

> Is this the expected behavior? Please help me understand what is happening.

We can certainly help you with this, but were going to need more info.  See my other comments.

> Thanks in advance.
> -Anu
> Adding to the previous information, though the minIdle is set to a value
> greater than 0, size of the pool, number of idle connections and number of
> active connections, all these are displayed as 0!

Connection counts can legitimately go to zero under certain conditions.  Are you seeing any
error or warning messages from the connection pool in your logs?


> -Anu

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message