You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Piyush Sheth <pi...@imagine-sw.com> on 2001/01/09 18:49:48 UTC

cocoon and database Connection

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.


Re: cocoon and database Connection

Posted by Berin Loritsch <bl...@apache.org>.
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 <bl...@apache.org>
> To: <co...@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.


Re: cocoon and database Connection

Posted by Piyush Sheth <pi...@imagine-sw.com>.
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.

----- Original Message -----
From: Berin Loritsch <bl...@apache.org>
To: <co...@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.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


Re: cocoon and database Connection

Posted by Berin Loritsch <bl...@apache.org>.
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.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org



Re: cocoon and database Connection

Posted by Matthew Cordes <mc...@maine.edu>.
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).

-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.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>