cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: cocoon and database Connection
Date Tue, 09 Jan 2001 20:52:16 GMT
Piyush Sheth wrote:

> That's what one would expect of database connection( as done in Cocoon2 )
> management.
> 
> Is it possible to use my own database connection pool( such that it starts
> when cocoon starts ) and ends once cocoon's
> lifetime ends ? If yes how can it be done with cocoon-1.8/2 ?
> 
> piyush.

The short answer is yes.  The long answer depends on if the
pooling is yours or not.  Cocoon 2 defines a DataSourceComponent
that lives in the Component heirarchy of Cocoon.  It's only
method is getConnection().  If you want to use your own
pooling, then you would create an implementation of the
DataSourceComponent that calls your pool.

If you are wanting to use normal JDBC connections, then the
Component is already there.  You only have to specify the
settings in the cocoon.xconf file.

If you want to use a J2EE Application Server's pooling, then
the DataSourceComponent for that has not yet been written.
It is in my todo list for the (very) near future.

For Cocoon 1.8+ it uses a separate project that pools the
Connection objects for you--but it only works for certain
JDBC drivers (the Cocoon 2 version is much more generic).
You will have to ask someone more familiar with the Cocoon 1.8+
code how that would be done for you.

> 
> ----- Original Message -----
> From: Berin Loritsch <bloritsch@apache.org>
> To: <cocoon-users@xml.apache.org>
> Sent: Tuesday, January 09, 2001 1:43 PM
> Subject: Re: cocoon and database Connection
> 
> 
> 
>> Matthew Cordes wrote:
>> 
>> 
>>> Cocoon itself does nothing, but you can use the turbine connection
>>> pool to have a pool of persistent connections (see your
>>> cocoon.properties file).  In lieu of that you'd need to make at least
>>> a connection per page (use the pool).
>> 
>> In Cocoon 2, there is a pooled Jdbc Connection facility.
>> You specify your connection and give it a name in the
>> cocoon.xconf file (look in the supplied version on how
>> to do that), and then reference it with the <esql:use-connection>
>> tag or <sql:use-connection> tag.
>> 
>> The connections are pooled and kept open until the system
>> shuts down.  It reclaims connections that are not used
>> when they are no longer needed.
>> 
>> 
>>> -matt
>>> 
>>> On Tue, Jan 09, 2001 at 12:49:48PM -0500, Piyush Sheth wrote:
>>> 
>>> 
>>>> How does cocoon manage database connection ?
>>>> Does it establish database connection everytime a document( obviously
>>> 
> it has
> 
>>>> some fields from database )
>>>>  is requested or the connection is persists once cocoon is initialized
>>> 
> and
> 
>>>> until it is shutdown.
>>>> 
>>>> 
>>>> Piyush.


Mime
View raw message