Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 20807 invoked from network); 4 Jul 2003 19:02:48 -0000 Received: from post.cnt.ru (212.15.122.243) by daedalus.apache.org with SMTP; 4 Jul 2003 19:02:48 -0000 Received: from ppp3-120.dial-up.cnt.ru (ppp3-120.dial-up.cnt.ru [212.15.120.120]) by post.cnt.ru (8.11.7/8.11.1) with ESMTP id h64J2p819461 for ; Fri, 4 Jul 2003 23:02:51 +0400 Date: Fri, 4 Jul 2003 23:03:31 +0400 From: Anton Tagunov X-Mailer: The Bat! (v1.60h) X-Priority: 3 (Normal) Message-ID: <445462755.20030704230331@mail.cnt.ru> To: "Jakarta Commons Users List" Subject: Re[2]: [DBCP] connection pool shutdown In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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