Hi You can use the simple registry http://camel.apache.org/registry.html
And put the sql data source on the registry with a given name. Its just a Map And then pass that registry in the DefaultCamelContext constructor. On Fri, Mar 22, 2013 at 12:31 AM, takidean <takide...@hotmail.fr> wrote: > hi everybody this is my apache camel code: > > > > > > public class Cntx { > > /** > * @param args > * @throws Exception > */ > public static void main(String[] args) throws Exception { > // TODO Auto-generated method stub > CamelContext context = new DefaultCamelContext(); > context.addRoutes(new MyRouteBuilder()); > context.start(); > Thread.sleep(10000); > context.stop(); > } > > } > > > > > > /*********route*//////// > > public class MyRouteBuilder extends RouteBuilder { > > /** > * Let's configure the Camel routing rules using Java code... > */ > public void configure() { > > // here is a sample which processes the input files > // (leaving them in place - see the 'noop' flag) > // then performs content based routing on the message using XPath > from("file:src/data?noop=true") > .choice() > .when(xpath("/person/user = 'SFIN'")) > .setBody(constant("INSERT INTO user > values('A','b','vvv');")).to("jdbc://timlogdb/") > .otherwise() > .to("file:target/messages/others"); > } > > } > > > > > > /*************camel context*******/ > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > <camelContext trace="false" xmlns="http://camel.apache.org/schema/spring"> > <route/> > </camelContext> > <bean id="timlogdb" > class="org.springframework.jdbc.datasource.DriverManagerDataSource"> > <property name="driverClassName" value=" com.mysql.jdbc.Driver"/> > <property name="url" value="jdbc:mysql://127.0.0.1:3306/examen" /> > <property name="username" value="root" /> > <property name="password" value="" /> > </bean> > </beans> > > > > > > /********* errors***********/ > Exception in thread "main" org.apache.camel.FailedToCreateRouteException: > Failed to create route route1 at: >>> Choice[[When[xpath{/person/user = > 'SFIN'} -> [SetBody[{INSERT INTO user values('A','b','vvv');}], > To[jdbc://timlogdb/]]]] Otherwise[[To[file:target/messages/others]]]] <<< in > route: Route[[From[file:src/data?noop=true]] -> [Choice[[When[xpath... > because of Failed to resolve endpoint: jdbc://timlogdb/ due to: No bean > could be found in the registry for: timlogdb/ of type: javax.sql.DataSource > > Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to > resolve endpoint: jdbc://timlogdb/ due to: No bean could be found in the > registry for: timlogdb/ of type: javax.sql.DataSource > > Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in > the registry for: timlogdb/ of type: javax.sql.DataSource > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/how-to-do-a-registry-of-type-javax-sql-DataSource-tp5729644.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: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen