You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/07/04 21:03:31 UTC
Re[2]: [DBCP] connection pool shutdown
Hello, Srinath!
sn> But I don't want the context to be reloaded as well.
sn> I just want to terminate all the connections to the database.
sn> I am using sql server, if I want to rebuild user security or restore
sn> database,
sn> there should not be any connection to the database. So I just need to close
sn> all the connections.
well, I doubt it can be done with fetching the datasource
via JNDI, but you could
a) make all the access to the pool via the ServletContext
b) implement a specialized managing servlet
that would act on two uri-s: /down and /up
on /up it would
1. fetch the DataSourcePreviously bound into ServletContext
2. call .close() on it
3. create a new BasicDataSource
4. bind it into the ServletContext
on /down it would
1. unbind the datasource from ServletContext, call
2. call .close() on it
c) implement a ServletContextListener that would
on servlet application startup create a new DataSource
and bind it into the ServletContext
d) all the components using the DataSource should be
prepared to handle the situation when they find
no BasicDataSource in the ServletContext
(since it may have been /down-ed)
alternatively (if your servlet api < 2.3)
you may use not a ContextListener, but
the same servlet that handles /up and /down
could on its startup do it
e) you should properly safeguard access to these
/up and /down url-s to prevent malicious user
from bringing your database access down.
at the very minimum you would probably want
to shield them with username/password in
the normal way it is done with Tomcat
(or Apache httpd if you're running via it)
Please consider sending your control servlet back
to the list after you have this up and running.
-Anton
[DBCP] Jdbc2PoolDataSource closeAll and close
Posted by srinath narasimhan <sr...@nuviewinc.com>.
Has anybody used the closeAll and close methods in the Jdbc2PoolDataSource
class ?
They seem to be not working.
any help/suggestions would be of help.
Thanks
Srinath.