You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Oki DZ <ok...@pindad.com> on 2001/09/18 08:10:46 UTC

Getting a hold on a component

Hi,

I'd like to have a JDBC connection out of a db pool from my class (which
happens to be not a Component). How can I accomplish this? It seems that
if you use DefaultComponentManager.lookup(), you have to invoke that from
a Component (which was loaded/used by a Block).

TIA,
Oki



---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Getting a hold on a component

Posted by Peter Donald <do...@apache.org>.
On Tue, 18 Sep 2001 16:10, Oki DZ wrote:
> I'd like to have a JDBC connection out of a db pool from my class (which
> happens to be not a Component). How can I accomplish this? It seems that
> if you use DefaultComponentManager.lookup(), you have to invoke that from
> a Component (which was loaded/used by a Block).

I am not sure what you mean. You can always go something like

JdbcDataSource ds = new JdbcDataSource();
ds.configure( myConfig );
ds.initialize();

ds.getConnection();

As most people use Avalon outside of Phoenix you definetly don't need to be a 
Block (or a Component) to do above. However if you want to receive the 
Component via a ComponentManager then you have to implement Composable.

-- 
Cheers,

Pete

---------------------------------------------------------------
The difference between genius, and stupidity? Genius has limits
---------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org