This was an interesting thought from the Struts dev list regarding a 
test method for the db conn pool.  Does DBCP have something like this? 
Would something like this be useful?  I would think so.

Scott

-------- Original Message --------
Subject: Re: Data Connection Pool, solution?
Date: Tue, 17 Apr 2001 22:42:29 +0200
From: "Johan Compagner" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>,   "struts dev" 
<[EMAIL PROTECTED]>
References: <F155F3F9C943D211943400A0C9AC1F49020A2DC3@NT40_SERVER>

there should be another attribute  in the datasource like this:

     testSql="select * from test"

and GenericConnection has a setTestSql(String) method
and that test method is executed right before the connections is given 
to the
request in getConnection()
When it fails it closed and tries another one (or opens another one)
So anyone can decide there own test method/sql statement, because
i don't think there is a common one.

Only some rules must be set:
Must the testSQL string return a result set and must it have one result
if not it is the same as failing?

This would be a nice addition to struts 1.0!

Johan Compagner



 >  <data-sources>
 >   <data-source
 >    autoCommit="false"
 >    description="Interbase Data Source"
 >    driverClass="interbase.interclient.Driver"
 >    maxCount="4"
 >    minCount="0"
 >    url="jdbc:interbase://path/to/database"
 >    user="username"
 >    password="password"
 >   />
 >  </data-sources>
 >
 > Anthony
 >
 > It is by caffeine alone I set my mind in motion.
 > It is by the Beans of Java that thoughts acquire speed,
 > the hands acquire shaking, the shaking becomes a warning.
 > It is by caffeine alone I set my mind in motion.
 >

Reply via email to