On 13.May.2002 -- 05:48 PM, Michael Mangeng wrote:
> Hi
> 
> I was wondering how i can access a pooled db connection within a action...
> in the turorial at http://xml.apache.org/cocoon/developing/datasources.html is 
>mentioned in the action example:
> import org.apache.cocoon.Roles;
> 
> the problem is that this class doesn´t exist in cocoon-2.0.2.jar....
> 
> is there another way to access the db or from where can i get this 
>org.apache.cocoon.Roles class ?

Please look at how it is done e.g. in AbstractDatabaseAction /
DatabaseAddAction and correct the docs :-)

Your action needs to implement the Composable interface:

    /**
     * Compose the Actions so that we can select our databases.
     */
    public void compose(ComponentManager manager) throws ComponentException {
        this.dbselector = (ComponentSelector) manager.lookup(DataSourceComponent.ROLE 
+ "Selector");

        super.compose(manager);
    }

and then

     DataSourceComponent datasource = (DataSourceComponent) 
this.dbselector.select(dataSourceName);
     Connection conn = datasource.getConnection();

HTH

        Chris.

-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to