cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Okraszewski <okrasz_n...@o2.pl>
Subject Re: How to obtain db connection from pool ?
Date Mon, 15 Dec 2003 22:24:59 GMT
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


Mime
View raw message