You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Norman Maurer <no...@googlemail.com> on 2011/09/03 09:51:59 UTC
Re: Getting a Database connection
Hi there,
just use @Resource annotation to injectit.
something like:
@Resource(name = "datasource")
bye
norman
Am Montag, 29. August 2011 schrieb Pietro Romanazzi <
p.romanazzi@ct.rupar.puglia.it>:
> Dear All,
> with the Avalon deployment of james (2.3.2) I used the following code to
get a db connection within a mailet:
> ServiceManager serviceManager = (ServiceManager)
> this.mailetContext.getAttribute(Constants.AVALON_COMPONENT_MANAGER);
>
> // Get the DataSourceSelector block
> DataSourceSelector ds = (DataSourceSelector)
> serviceManager.lookup(DataSourceSelector.ROLE);
> DataSourceComponent dc = (DataSourceComponent)
ds.select("maildb");
> conn = dc.getConnection();
> ...
> ...
>
> Has anyone tried the same thing with Spring deployment?
> Thanks and regards,
>
> Pietro
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>