Hello 'spinners'

I would like to pass a connection from the pool to a java class

The documentation at
http://xml.apache.org/cocoon/developing/datasources.html is out of date I
think.

It suggests I do ........................................

import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.cocoon.Roles;
import org.apache.avalon.excalibur.datasource.DataSourceComponent;

import java.sql.Connection;

// .... Skip a lot of lines until we are in the method you use
//      to initialize the DataSourceComponent ....

private DataSourceComponent datasource;

public void compose(ComponentManager manager) {
    ComponentSelector selector =
        (ComponentSelector) manager.lookup(Roles.DB_CONNECTION);
    this.datasource = (DataSourceComponent)
selector.select("MyConnectionName");
}

// .... Skip more lines until we actually need to use the datasource

private void meMethod() {
    Connection myConnection = this.datasource.getConnection();

    // .... perform SQL code here

    myConnection.close();
}

...............................................................

but there's no longer an org.apache.cocoon.Roles class in the classpath

can anyone help?

Thanks


---------------------------------------------------------------------
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