Hi all.
I found it!
In the mailet:
MailetContext mc = getMailetContext();
DefaultComponentManager cm =
(DefaultComponentManager)mc.getAttribute("AVALON_COMP_MGR");
cm.lookup("org.apache.avalon.cornerstone.services.datasource.DataSourceSelec
tor");
DataSourceSelector  ds =
(DataSourceSelector)cm.lookup(DataSourceSelector.ROLE);
// here is a fixed string, but it should be parsed from a mailet's init
parameter, like in JDBCVirtualUserTable
String datasourcename = "maildb";
DataSourceComponent dc = (DataSourceComponent) ds.select(datasourcename);
Connection conn = dc.getConnection(); 

It works.
Cheers
Marcello

> -----Messaggio originale-----
> Da: Marcello Marangio [mailto:[EMAIL PROTECTED] 
> Inviato: mercoledì 15 febbraio 2006 11.46
> A: 'James Users List'
> Oggetto: How to use the data-sources in a mailet
> 
> Hi all.
> I would like to update the db schema I declared in the 
> config.xml with a custom table to be used in a mailet.
> How can I use the data-source configured in the config.xml?
> 
> Thanks
> Marcello
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to