camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From takidean <takide...@hotmail.fr>
Subject Re: how to do a registry of type: javax.sql.DataSource
Date Sat, 23 Mar 2013 21:30:25 GMT
Hi Mr claus is still get this message im so pressed i have to do it for my
project of end of year
/**************main**********/
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		//DataSource dd;
		 DriverManagerDataSource ds = new DriverManagerDataSource();
		 
	      ds.setDriverClassName("com.mysql.jdbc.Driver");
	    ds.setUrl("jdbc:mysql://localhost:3306/examen");
	    ds.setUsername("root");
	    ds.setPassword("");
	       //JndiRegistry reg = null;

	        SimpleRegistry reg = new SimpleRegistry() ;
	        reg.put("datasource",ds); 
//	        reg.bind("datasource","timlogdb");

        CamelContext context = new DefaultCamelContext(reg);
context.addRoutes(new MyRouteBuilder());
context.start();
Thread.sleep(10000);
context.stop();
	}

}





/*********Route builder*******/



  public void configure() {
    	/* DriverManagerDataSource ds = new DriverManagerDataSource();
	      ds.setDriverClassName("com.mysql.jdbc.Driver");
	    ds.setUrl("jdbc:mysql://localhost:3306/examen");
	    ds.setUsername("root");
	    //ds.setPassword("");
	    //SimpleRegistry reg = new SimpleRegistry() ;
       // reg.put("datasource",ds); 
        // 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:jdbc:mysql://localhost:3306/examen")
        .otherwise()
        .to("file:target/messages/others");
                        }

}




--
View this message in context: http://camel.465427.n5.nabble.com/how-to-do-a-registry-of-type-javax-sql-DataSource-tp5729644p5729721.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message