Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 16426 invoked by uid 99); 7 Jan 2005 05:15:09 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of clinton.begin@gmail.com designates 64.233.184.206 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.206) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 06 Jan 2005 21:15:08 -0800 Received: by wproxy.gmail.com with SMTP id 68so435133wri for ; Thu, 06 Jan 2005 21:15:06 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=RT9h5G2g6ZTBHjZSJlzhtTOVc1pGWaHH5v5Txs5P3c1C+EPM4ZDOfeg+rftp2xzHfZBdplpoBKJQS0iqO61gxNjwAL3q09n83qwwLAx+QqUi+NaokDMy1t5MzXGCg5/HCWqqonTgtjJ0XgTMaRk77uG+oQ867NbAElH9GOrbrpg= Received: by 10.54.22.59 with SMTP id 59mr146794wrv; Thu, 06 Jan 2005 21:15:06 -0800 (PST) Received: by 10.54.33.38 with HTTP; Thu, 6 Jan 2005 21:15:06 -0800 (PST) Message-ID: <16178eb10501062115675412b@mail.gmail.com> Date: Thu, 6 Jan 2005 22:15:06 -0700 From: Clinton Begin Reply-To: cbegin@ibatis.com To: ibatis-user-java@incubator.apache.org Subject: Re: Connections In-Reply-To: <41DE161C.1020402@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1105033306.41dd785aa9150@www.kattare.com> <41DE161C.1020402@gmail.com> X-Virus-Checked: Checked When it comes to connection pools, it's the responsibility of each pool to ensure that their connections are closed. iBATIS can't do much in this regard. I suggest you enforce a manual shutdown policy for your datasources, as simply shutting down a JVM (i.e. service) won't cut it. If you're using iBATIS SimpleDataSource, you can call .forceCloseAll() to release all Connection resources. For any other DataSource implementation, you'll need to check the docs (it's non-standard behavior). Cheers, Clinton On Fri, 07 Jan 2005 10:24:52 +0530, Vamsee Kanakala wrote: > Carl Brodeur wrote: > > >Would like to know how Ibatis releases or close its connections. I use > >a JNDI datasource type (connection pool). I look at the debug trace, > >see when connection are requested but not when they are released. > > > > > > > I have a similar problem. I am using sqlmaps only, and I'm getting the > datasource connection from the container itself, like this: > > public class BatsSqlConfig { > private static final SqlMapClient sqlMap; > > static { > try { > String resource = "com/mafoi/bats/sql-map-config.xml"; > Reader reader = Resources.getResourceAsReader(resource); > sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); > } catch (Exception e){ > e.printStackTrace(); > throw new RuntimeException("Init error: BatsSqlConfig class. > cause: " + e); > } > } > > public static SqlMapClient getSqlMapInstance() { > return sqlMap; > } > } > > And, I'm using the code like this: > > public class LoginBean { > > SqlMapClient sqlMap; > > public LoginBean() { > sqlMap = BatsSqlConfig.getSqlMapInstance(); > } > > public User getUser(String userName, String password) throws > SQLException { > > return (User)sqlMap.queryForObject("getUser", > userName); > } > } > > But, I'm using Tomcat Ant tasks to stop and start the container. I get > the feeling that the connections are not closed, because 2 developer > machines (linux) just hung after doing a few start/stops of the > application inside Tomcat. It never happened before, while we used to > shutdown tomcat fully before deploying the application again. How can I > make sure that the PoolableConnection objects are actually released > before I restart the application in Tomcat? > > TIA, > Vamsee. >