tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Uctaa" <duc...@gmail.com>
Subject Re: How to forcibly close abandoned database connections?
Date Wed, 10 Jan 2007 16:10:05 GMT
In server.xml, within GlobalNamingResources, include something like this:

<Resource
auth="Container"
driverClassName="com.ibm.as400.access.AS400JDBCDriver"
maxActive="30"
maxIdle="2"
maxWait="5000"
name="jdbc/something"
password="password"
type="javax.sql.DataSource"
url="jdbc:as400://abc.def.com"
username="username"
removeAbandoned="true"
removeAbandonedTimeout="120"
logAbandoned="true"/>

Within the context.xml in your application's META-INF folder, include
this underneath the <Context> element:

<ResourceLink
global="jdbc/something"
name="jdbc/something"
type="javax.sql.DataSource" />

Within your appilcation code, include something like this:

InitialContext initCtx = new InitialContext();
Context ctx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) ctx.lookup("jdbc/something");
Connection con = ds.getConnection();

Make sure jt400.jar resides in your tomcat's common/lib folder

Hope this helps.




On 1/10/07, Greg Foulks <gfoulks@gmail.com> wrote:
> David,
> Any chance you could share with me your connection pool configuration? I've
> been struggling with trying to setup my own connection to our DB2 using the
> jt400 jar and have not been able to find any documentation for doing this
> with a DB2 connection.
>
> Thanks,
> Greg
>
>
> On 1/10/07, David Uctaa <ductaa@gmail.com> wrote:
> >
> > Perhaps I was unclear what it is I'm trying to do.  I have a
> > connection pool set up under Tomcat 5.5, connecting to DB2 on an
> > iSeries box using Tomcat's DBCP.  It is set up for 30 connections.  I
> > am using Lambda Probe (a great open source Tomcat monitoring app) to
> > monitor the datasources.  It is showing, let's say, that there are a
> > max of 30 connections allowed, that 11 have been "established", and 9
> > are "busy".  I know that these 9 are due to a connection pool leak bug
> > that was corrected (but not yet deployed), so even though the
> > application has gone idle and no one is using it, the connections
> > remain "busy" indefinitely.  I have enabled removeAbandoned in my
> > server.xml, but according to the Tomcat docs, abandoned connections
> > are only recycled if there is a need for them, due to the number of
> > available datasources getting low.  The number of available
> > datasources are not yet low, so these orphaned connections are still
> > being reported as "busy".  I'm a little bit anal with regard to
> > keeping things kinda clean on the server, so I would like to have
> > these abandoned connections no longer reported as "busy" once they are
> > orphaned.  Is there a way to find and recycle abandoned connections
> > forcibly?
> >
> > Thanks,
> > David
> >
> > On 1/8/07, David Uctaa <ductaa@gmail.com> wrote:
> > > Tomcat provides the removeAbandoned and removeAbandonedTimeout
> > > parameters when setting up data sources in server.xml.  But according
> > > to the documentation I've read, abandoned connections only get closed
> > > and recycled when available connections run low and new connections
> > > are requested.
> > >
> > > Is there a way for me to forcibly close/release abandoned connections
> > > on the server from a privileged application running on the same
> > > server?
> > >
> > > BTW, I'm running Tomcat 5.5 on a Windows 2003 box, running against DB2
> > > on an iSeries box (jt400 for the JDBC driver), using Tomcat's DBCP for
> > > the pooling.
> > >
> > > Thanks,
> > > David
> > >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message