Hi In the XML you have a <split> And in the Java DSL you do not have a .split()
So they are not the same. On Fri, Feb 21, 2014 at 6:58 PM, bhagavan <suryabhagavanpad...@gmail.com> wrote: > <camel:route id="Csv to DB example" > autoStartup="true"> > <camel:from > uri="file:input/csv?noop=true&delay=10" /> > <camel:split parallelProcessing="true" > streaming="true"> > <camel:tokenize token="\n" group="1" /> > <camel:unmarshal> > <camel:csv /> > </camel:unmarshal> > <transform> > <simple>${body[0]}</simple> > </transform> > <camel:to > uri="sql:insert into palyer (id, > name, city) values > (#,#,#)?dataSourceRef=dataSource" /> > </camel:split> > <camel:stop /> > </camel:route> > > When I try with following code > > public void configure() throws Exception { > logger.info("CSV file to Database"); > from("file:input/inbox?noop=true"). > unmarshal().csv().transform().body(). > to("sql:insert into palyer (id, name, city) values > (#,#,#)?dataSourceRef=dataSource"). > stop(); > } > > I got this error > > thread #0 - file://input/inbox] GenericFileOnCompletion WARN > Rollback file strategy: > org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@1f707a6a > for file: GenericFile[data.txt] > [thread #0 - file://input/inbox] DefaultErrorHandler ERROR Failed > delivery for (MessageId: ID- PC-56648-1393004785733-0-69 on ExchangeId: > ID-vgsc-PC-56648-1393004785733-0-70). Exhausted after delivery attempt: 1 > caught: org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > palyer (id, name, city) values (?,?,?)]; SQL state [null]; error code [0]; > Number of parameters mismatch. Expected: 3, was:2; nested exception is > java.sql.SQLException: Number of parameters mismatch. Expected: 3, was:2 > org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > palyer (id, name, city) values (?,?,?)]; > SQL state [null]; error code [0]; Number of parameters mismatch. Expected: > 3, was:2; > nested exception is java.sql.SQLException: Number of parameters mismatch. > Expected: 3, was:2 > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/I-want-change-my-route-config-Spring-DSL-to-Java-DSL-below-code-but-I-got-sql-mismatched-exception-tp5747785.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io