You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Kirk <to...@web-startup.co.uk> on 2004/11/09 01:44:37 UTC

Are all TC-managed DataSources pooled?

The docs under 'JDBC Data Sources' at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html 
say, "The J2EE Platform Specification requires J2EE Application Servers to
make available a DataSource implementation (that is, a connection pool for
JDBC connections)."  

Now, I'm *not* criticising the docs, I'm seeking clarification.  I'm not
sure whether this is saying that a JDBC DataSource has to be pooled?  Or is
instead saying that J2EE requires pooled JDBC connections, or maybe that
J2EE requires connections via a DataSource?

I didn't think that DataSources had to be pooled, based on what is says
here: 
http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html 

This might sound like nit picking, but the answer to this will help me help
someone else on another thread.  Thanks.




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Are all TC-managed DataSources pooled?

Posted by Peng Tuck Kwok <pe...@gmail.com>.
For JDBC if it's not pooled in a container, it would be of little use 
to any application. Specifically the tomcat docs do say that
connection pool is provided right here :
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations

Just set it up according to the docs(with changes for your jdbc
driver) and you're good to go.





On Wed, 10 Nov 2004 23:30:08 -0000, Steve Kirk
<to...@web-startup.co.uk> wrote:
> 
> No interest in my original post so I'll rephrase.
> 
> Is every container-managed DataSource configured in TC (e.g. via server.xml
> / context.xml) automatically made pooled using commons pooling?  Or can
> ordinary non-pooled connections be created too using this mechanism?
> 
> > -----Original Message-----
> > From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> > Sent: Tuesday 09 November 2004 00:45
> > To: 'Tomcat Users List'
> > Subject: Are all TC-managed DataSources pooled?
> >
> > The docs under 'JDBC Data Sources' at
> > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources
> > -howto.html
> > say, "The J2EE Platform Specification requires J2EE
> > Application Servers to
> > make available a DataSource implementation (that is, a
> > connection pool for
> > JDBC connections)."
> >
> > Now, I'm *not* criticising the docs, I'm seeking
> > clarification.  I'm not
> > sure whether this is saying that a JDBC DataSource has to be
> > pooled?  Or is
> > instead saying that J2EE requires pooled JDBC connections, or
> > maybe that
> > J2EE requires connections via a DataSource?
> >
> > I didn't think that DataSources had to be pooled, based on
> > what is says
> > here:
> > http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
> >
> > This might sound like nit picking, but the answer to this
> > will help me help
> > someone else on another thread.  Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Are all TC-managed DataSources pooled?

Posted by Steve Kirk <to...@web-startup.co.uk>.
Thanks for your comments Doug.  Good point re relevance of javax.sql API
docs.

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:

J2EE.5.4.3 ("J2EE Product Provider's Responsibilities") says, "While not
required by this specification, most J2EE products will provide the
following features:...... A mechanism to pool resources for the application
components and otherwise manage the use of resources by the container. The
pooling must be transparent to the application components."

J2EE6.2.4.3 ("JDBC API") says, "The JDBC API includes APIs for ...
connection pooling ... The connection pooling and distributed transaction
features are intended for use by JDBC drivers to coordinate with an
application server. J2EE products are not required to support the
application server facilities described by these APIs, although they may
prove useful."

Can anyone point me at a section of J2EE that says that pooling is required
for container-managed DataSources?

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>

as suggested at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html 
compared to not including a "factory" param at all?

To reiterate, my original issue is that I'm trying to understand whether or
not TC *always* pools container-managed DataSources.

> -----Original Message-----
> From: Parsons Technical Services 
> [mailto:parsonstechnical@earthlink.net] 
> Sent: Thursday 11 November 2004 02:37
> To: Tomcat Users List
> Subject: Re: Are all TC-managed DataSources pooled?
> 
> 
> > Is every container-managed DataSource configured in TC (e.g. via 
> > server.xml
> > / context.xml) automatically made pooled using commons pooling?
> 
> Yes. No additional code is needed (i.e. TC takes care of the pool.)
> 
> Or can
> > ordinary non-pooled connections be created too using this mechanism?
> >
> No, as it would not be compliant. It might be possible to 
> create a pool of 
> one connection, but it would still be handled as a pool.
> 
> To answer your original questions:
> 
> 
> >> Now, I'm *not* criticising the docs, I'm seeking
> >> clarification.  I'm not
> >> sure whether this is saying that a JDBC DataSource has to be
> >> pooled?  Or is
> >> instead saying that J2EE requires pooled JDBC connections, or
> >> maybe that
> >> J2EE requires connections via a DataSource?
> >>
> To meet the J2EE requirement the DataSource method must be 
> made avalible in 
> a pooled configuration.
> 
> 
> >> I didn't think that DataSources had to be pooled, based on
> >> what is says
> >> here:
> >> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
> >>
> 
> This is only the API for the language. The language may be 
> able to do many 
> things that are not compliant with the J2EE standard 
> reguarding the server. 
> Think about if you were writing a stand alone desktop app and 
> had it talking 
> to a datasource. The J2EE requirements for the server are of 
> no interest and 
> don't apply.
> 
> >> This might sound like nit picking, but the answer to this
> >> will help me help
> >> someone else on another thread.  Thanks.
> >
> 
> Hope they get the picture.
> 
> Doug
> www.parsonstechnical.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Are all TC-managed DataSources pooled?

Posted by Parsons Technical Services <pa...@earthlink.net>.
> Is every container-managed DataSource configured in TC (e.g. via 
> server.xml
> / context.xml) automatically made pooled using commons pooling?

Yes. No additional code is needed (i.e. TC takes care of the pool.)

Or can
> ordinary non-pooled connections be created too using this mechanism?
>
No, as it would not be compliant. It might be possible to create a pool of 
one connection, but it would still be handled as a pool.

To answer your original questions:


>> Now, I'm *not* criticising the docs, I'm seeking
>> clarification.  I'm not
>> sure whether this is saying that a JDBC DataSource has to be
>> pooled?  Or is
>> instead saying that J2EE requires pooled JDBC connections, or
>> maybe that
>> J2EE requires connections via a DataSource?
>>
To meet the J2EE requirement the DataSource method must be made avalible in 
a pooled configuration.


>> I didn't think that DataSources had to be pooled, based on
>> what is says
>> here:
>> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
>>

This is only the API for the language. The language may be able to do many 
things that are not compliant with the J2EE standard reguarding the server. 
Think about if you were writing a stand alone desktop app and had it talking 
to a datasource. The J2EE requirements for the server are of no interest and 
don't apply.

>> This might sound like nit picking, but the answer to this
>> will help me help
>> someone else on another thread.  Thanks.
>

Hope they get the picture.

Doug
www.parsonstechnical.com



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Are all TC-managed DataSources pooled?

Posted by Steve Kirk <to...@web-startup.co.uk>.
No interest in my original post so I'll rephrase.

Is every container-managed DataSource configured in TC (e.g. via server.xml
/ context.xml) automatically made pooled using commons pooling?  Or can
ordinary non-pooled connections be created too using this mechanism?

> -----Original Message-----
> From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk] 
> Sent: Tuesday 09 November 2004 00:45
> To: 'Tomcat Users List'
> Subject: Are all TC-managed DataSources pooled?
> 
> The docs under 'JDBC Data Sources' at 
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources
> -howto.html 
> say, "The J2EE Platform Specification requires J2EE 
> Application Servers to
> make available a DataSource implementation (that is, a 
> connection pool for
> JDBC connections)."  
> 
> Now, I'm *not* criticising the docs, I'm seeking 
> clarification.  I'm not
> sure whether this is saying that a JDBC DataSource has to be 
> pooled?  Or is
> instead saying that J2EE requires pooled JDBC connections, or 
> maybe that
> J2EE requires connections via a DataSource?
> 
> I didn't think that DataSources had to be pooled, based on 
> what is says
> here: 
> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html 
> 
> This might sound like nit picking, but the answer to this 
> will help me help
> someone else on another thread.  Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org