commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin van Dijken" <mvdij...@madocke.nl>
Subject RE: DBCP tracking stale connections?
Date Tue, 07 Jan 2003 11:17:12 GMT
Hey Linda,

I tested the DBCP in a number of situations. I'm sorry to say I'm not very enthusiastic. A
number of vague issues I found while testing it, gave me a feeling that it was not quite done
yet and sure as hell not documented well. I will tell you what I found for documentation/experience,
so you can try it yourself:

This link shows some basic setup stuff for a DBCP connection in Tomcat
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
This email has a fairly complete DBCP config which you can tweak for your own purposes:
http://archives.apache.org/eyebrowse/ReadMsg?listName=commons-user@jakarta.apache.org&msgId=518453
What you probably want to do is test that your connections are still open before you use them.
This should assure that your connection is open before your application uses it. This can
be accomplished using:
                        <parameter>
                            <name>validationQuery</name>
                            <value>SELECT 1</value>
(or any other fast query that checks your database connection is open)
                        </parameter>

As said, I'm not convinced of the stability of DBCP and am currently investigating a different
means of storing stuff in the database. 

Hope I'v helped you out a little

Martin van Dijken

> -----Original Message-----
> From: Linda Steckel [mailto:Linda@FriedWire.com]
> Sent: dinsdag 7 januari 2003 0:13
> To: Martin van Dijken
> Subject: RE: DBCP tracking stale connections?
> 
> 
> Martin,
> 
> I read your thread on Apache regarding dbcp tracking stale 
> connections and
> was wondering how your situation ended.  I am relatively new 
> to Tomcat, so
> like you I desire simple instructions.  Did you end up using 
> jdbc2pool or
> BasicDataSource?  I'm not sure I understand the difference.  
> Did you end up
> using more up to date code?  I have the dbcp connection 
> working (Basic Data
> Source).  However, I noticed something strange, so I created 
> a test.  I use
> one connection only.  I also set the max wait to -1 so 
> connections don't
> time out.  The same pages refreshes over and over again.  
> There are numerous
> select statements and various servlets called to paint the 
> page.  They all
> use the same connection, so I know pooling works.  I also 
> have multiple
> browsers open painting the same page.  But then, without 
> warning (1 hour or
> 8 hours or 24 hours or 48 hours later), the only connection 
> is closed and
> not re-opened.  I don't know what closes it and I don't know 
> what I need to
> do to make it reopen.
> 
> Any suggestions you have would be greatly appreciated.
> 
> Thanks
> Linda
> 
> 

Mime
View raw message