cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Sieraczkiewicz <mariusz-sieraczkiew...@o2.pl>
Subject Re: How to obtain db connection from pool ?
Date Tue, 16 Dec 2003 00:08:27 GMT
There are two possibities I know:
1) flowscript
2) Avalon Component.

Please give some context. I guess the flowscript is the easiest
solution, I've adopted it from the code of database action, and it
looks almost the same (but written in javascript instead of java).
Because Cocoon is Avalon based I dont think there's other (non-Avalon)
possibility to achieve what you asked. Flowscript gives you access to
some Cocoon Avalon Components, which you can make use of mixing with
your own java components (not necesserily Avalon Components). I did so
and it works.

Regards Mariusz Sieraczkiewicz.

BTW It's very funny to write in English to Polish folk ;-)

On Mon, 2003-12-15 at 23:24, Marcin Okraszewski wrote:
> Hi,
> And how about obtaining it outside a flow? How to get the instance of 
> the component selector that I could run something similar to 
> cocoon.getComponent() from the example below?
> 
> Regards,
> Marcin Okraszewski
> 
> > Suggested using flowscript, then try sth like this:
> > 
> >     try {
> >         var dbSelector = 
> > cocoon.getComponent(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE

> > + "Selector");
> >         var dataSrc = dbSelector.select("your counnection");
> >         conn = dataSrc.getConnection();
> > 
> >       // your stuff
> >     }
> >     catch (e) {
> >         e.toString();
> >     }
> >     finally {
> >         if (conn != null) {
> >             conn.close();
> >             conn = null;
> >         }
> > 
> >         if (dbSelector != null) {
> >             cocoon.releaseComponent(dbSelector);
> >             dbSelector = null;
> >         }
> >     }
> > 
> > But if you write Avalon Component, just look at database actions sources.
> > 
> > Regards
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message