Subject Re: Tomcat contexts and pooled connections
Author Roman Rokytskyy
Hi,

> Is there a way to return the database connections to the pool when the
> servlet context is reloaded? I presume they're removed from memory and
> reloaded but different from restarting the tomcat server, the
> connections aren't returned.

In theory, if no hard reference on both connection and connection pool
exist, it will be garbage collected. This in turn means that after
some time connections will be closed.

You should try to call System.gc() after context reloading to prove my
statement (or prove the opposite). Note, calling System.gc() does
_not_ guarantee you that garbage collection will be done, but usually
GC agrees with user and does the garbage collection. :)

Best regards,
Roman Rokytskyy