jdbc:osgi:services/javax.sql.DataSource/(name=nomDatasource)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

jdbc:osgi:services/javax.sql.DataSource/(name=nomDatasource)

sekaijin
hello,

I try to use camel-jdbc as OSGI
my datasource is defined in another bundle and is published via OSGI

I can retrieve via lookup("jdbc:osgi:service/javax.sql.DataSource/(name=nomDatasource)")

but I do not know how to configure my url in my routeBuilder in java DSL
configure () {
  //the name of the datasource to use is defined in the configuration at boot bundle
  String url = getUrlFromConfigDb(); returns jdbc:nomDatasource at the moment but it does not work
  from (...)
  ...
  . to (url)
  ...
}
Thank you for your help
A+JYT
Reply | Threaded
Open this post in threaded view
|

Re: jdbc:osgi:services/javax.sql.DataSource/(name=nomDatasource)

Claus Ibsen-2
On Mon, Feb 11, 2013 at 2:43 PM, sekaijin <[hidden email]> wrote:
> hello,
>
> I try to use camel-jdbc as OSGI
> my datasource is defined in another bundle and is published via OSGI
>
> I can retrieve via
> lookup("jdbc:osgi:service/javax.sql.DataSource/(name=nomDatasource)")
>

Can you get the datasource using that lookup code?
If not you would need to lookup it using the OSGi API.


> but I do not know how to configure my url in my routeBuilder in java DSL
> configure () {
>   //the name of the datasource to use is defined in the configuration at
> boot bundle
>   String url = getUrlFromConfigDb(); returns jdbc:nomDatasource at the
> moment but it does not work
>   from (...)
>   ...
>   . to (url)
>   ...
> }
> Thank you for your help
> A+JYT
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/jdbc-osgi-services-javax-sql-DataSource-name-nomDatasource-tp5727351.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: jdbc:osgi:services/javax.sql.DataSource/(name=nomDatasource)

sekaijin
Hi,
Yes he can retrieve the datasource in my java code via lookup
but how to inject it in my routeBuilder?

ds = lookup (".....");

from ("jms:myQueue")
 .bean (myBean.class)
 .to ("jdbc:????");
how to write this last ".to(...)" to use the object ds?

thank
A+JYT
Reply | Threaded
Open this post in threaded view
|

Re: jdbc:osgi:services/javax.sql.DataSource/(name=nomDatasource)

Claus Ibsen-2
On Tue, Feb 12, 2013 at 5:49 PM, sekaijin <[hidden email]> wrote:
> Hi,
> Yes he can retrieve the datasource in my java code via lookup
> but how to inject it in my routeBuilder?
>
>
> how to write this last ".to(...)" to use the object ds?
>

The camel jdbc will lookup the data source like you can do with the
lookup from the RouteBuilder.

So have you tried

from X
  to("jdbc:jdbc:osgi:service/javax.sql.DataSource/(name=nomDatasource)");




> thank
> A+JYT
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/jdbc-osgi-services-javax-sql-DataSource-name-nomDatasource-tp5727351p5727440.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen