> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();


There is a shortcut in 3.1 for the code above:

  ServerRuntime runtime = ..
  DataSource ds = runtime.getDataSource("mynode");

JNDI mentioned by Ari is an even better alternative.

Andrus

> On Oct 31, 2014, at 8:49 AM, Markus Reich <markus.re...@markusreich.at> wrote:
> 
> Hi René,
> 
> yes you can access a connection
> 
> e.g.
> public static Connection getConnection() throws Exception {
>    return
> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();
>  }
> 
> 2014-10-31 3:30 GMT+01:00 René Aravena <rene.arav...@gmail.com>:
> 
>> With cayenne 3.1, as I can get the connection to the database to pass it to
>> jasperreports?
>> 
>> René
>> 
> 
> 
> 
> -- 
> *Markus Reich*
> Waldweg 62
> 6393 St. Ulrich am Pillersee
> www.markusreich.at / www.meeximum.at
> markus.re...@markusreich.at

Reply via email to