Thanks Yoav.  I see your original reply in the archive now, but I never got
it via email.  Strange.  I do occasionally get notifications from ezmlm that
my mailbox has been bouncing mails, but haven't had one of those for a
while.  I think the bouncing is due to false positives at my ISP spamfilter,
as my mailbox has plenty of free space.

So I'm going to submit an enhacement suggestion for the docs (5.0.x/5.5.x),
as they imply that DBCP is always used for datasources.

a couple more follow up Qs to clarify if you wouldn't mind:

> there are valid use-cases where you 
> don't want them pooled, although those are fairly esoteric.

Is this a case where I might use org.apache.commons.dbcp.BasicDataSource?
As far as I understand it, that class is DBCP's "standard" non-pooled
DataSource...?

And, are the following valid ways to tell whether a DataSource or Connection
has come from a pooled or non-pooled source? :
 if (conn instanceof javax.sql.PooledConnection)
 if (dataSource instanceof javax.sql.ConnectionPoolDataSource)

I ask this because, whether I specify the factory class or not, the
DataSource/Connection classes I get back are:
datasource class = org.apache.commons.dbcp.BasicDataSource
connection class =
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

which both fail the tests above, despite the latter's name implying
poolability

Maybe BasicDataSourceFactory does not produce a pooled DataSource(?), but
this seems odd given that it is the recommended class to use in the "MySql
DBCP example" in the docs here: 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html 

And I can't see another class within DBCP that looks like the pooled
datasource factory that I need to specify in my "factory" param...?

> -----Original Message-----
> From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 13:24
> To: Tomcat Users List
> Subject: RE: Are all TC-managed DataSources pooled?
> 
> 
> 
> Hi,
> I already answered this... Maybe my post was lost.
> 
> >I had a search through the J2EE spec.  It does not appear to me to
> >_require_
> >that DataSources are provided in a pooled implementation.  
> It seems to
> be
> >preferred.  For example:
> 
> You're right.  Containers are required to support binding of a
> DataSource, but it doesn't have to be pooling.  Most implementations
> give the user the choice, as does Tomcat.  You can use DBCP in
> non-pooling ways (set maxActive to infinite), or use any DataSource
> implementation whether it supports pooling or not.
> 
> >Also there are the other Qs in my last post - including, what is the
> effect
> >of including this:
> >     <parameter>
> >             <name>factory</name>
> >
> ><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> >     </parameter>
> 
> That's effectively required for Tomcat to be able to create
> org.apache.commons.dbcp.BasicDataSource instances.  The general JNDI
> approach in Tomcat is factory-based (this has since been replicated in
> many other server implementations), where the provider impl includes a
> factory, so Tomcat doesn't actually ever call x = new
> BasicDataSource(...).
> 
> >To reiterate, my original issue is that I'm trying to understand
> whether or
> >not TC *always* pools container-managed DataSources.
> 
> That's a simple No.  And there are valid use-cases where you 
> don't want
> them pooled, although those are fairly esoteric.
> 
> I wonder where my original post in this thread, which had all this
> information, went ;)
> 
> Yoav



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to