title: Apache Camel select then insert
body: <p>I am very very new to Apache Camel and I am looking to create a simple application which reads 200 products from mysql db 1 and then inserts the products into mysql db 2. No changes required to the data, it is just a one for one bulk select and then bulk insert.</p>
  
  <p>I have been looking at the camel-sql-example project which uses the sql component. I like the way it's structured so I've attempted to go with this example project as my base.</p>
  
  <p>Would anyone be able to help me with the location of a good example for this or giving me a rough indication of what my camel route (spring arcehtype) should look like?</p>
  
  <p>Is something like this correct?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
            http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
    &lt;bean id="sourceDataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      ...
    &lt;/bean&gt; 
  
    &lt;bean id="targetDataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      ...
    &lt;/bean&gt;     
  
    &lt;!-- configure the Camel SQL component to use the JDBC data source --&gt;
    &lt;bean id="sourceSql" class="org.apache.camel.component.sql.SqlComponent"&gt;
      &lt;property name="dataSource" ref="sourceDataSource"/&gt;
    &lt;/bean&gt;
  
    &lt;bean id="targetSql" class="org.apache.camel.component.sql.SqlComponent"&gt;
      &lt;property name="dataSource" ref="targetDataSource"/&gt;
    &lt;/bean&gt;
  
    &lt;bean id="productBean" class="org.apache.camel.example.sql.ProductBean"/&gt;
  
    &lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
      &lt;propertyPlaceholder location="classpath:sql.properties" id="placeholder"/&gt;
  
      &lt;route id="processProduct-route"&gt;
          &lt;from uri="sourceSql:{{sql.selectProduct}}"/&gt;
          &lt;to uri="targetSql:{{sql.insertProduct}}"/&gt;
          &lt;log message="${body}"/&gt;
      &lt;/route&gt;
  &lt;/camelContext&gt;
  </code></pre>
  
  <p>thanks  </p>