Hi You should not use bindy, but csv instead. Then you keep the data as map which the sql component supports.
Otherwise you can use mybatis instead of sql for inserting into database, as mybatis can map from java objects, which bindy creates. On Sun, Feb 23, 2014 at 10:06 AM, bhagavan <[email protected]> wrote: > hi > > After removing following lines of code > > <transform> > <simple>${body[0]}</simple> > </transform> > > I got this error > > Caused by: java.sql.SQLException: Number of parameters mismatch. Expected: > 3, was:1 > at > org.apache.camel.component.sql.SqlProducer.populateStatement(SqlProducer.java:108) > at > org.apache.camel.component.sql.SqlProducer.access$100(SqlProducer.java:32) > at > org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:64) > at > org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:48) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586) > ... 75 more > [ #0 - file://inbox/fixedlength] GenericFileOnCompletion WARN > Rollback file strategy: > org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@11c692c2 > for file: GenericFile[data.txt] > [ #0 - file://inbox/fixedlength] d-length-unmarshalling-example WARN CSV to > DB Using Bindy > [ #0 - file://inbox/fixedlength] d-length-unmarshalling-example WARN OUTPUT > FOR CSV Record ::: Employee [Id=5, name=ravi, city=hyd] > [ #0 - file://inbox/fixedlength] DefaultErrorHandler ERROR Failed > delivery for (MessageId: ID-vgsc-PC-49540-1393146134991-0-257 on ExchangeId: > ID-vgsc-PC-49540-1393146134991-0-259). Exhausted after delivery attempt: 1 > caught: org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > player (id, name, city) values (:?id,:?name,:?city)]; SQL state [null]; > error code [0]; Number of parameters mismatch. Expected: 3, was:1; nested > exception is java.sql.SQLException: Number of parameters mismatch. Expected: > 3, was:1 > org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > player (id, name, city) values (:?id,:?name,:?city)]; SQL state [null]; > error code [0]; Number of parameters mismatch. Expected: 3, was:1; nested > exception is java.sql.SQLException: Number of parameters mismatch. Expected: > 3, was:1 > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Store-CSV-file-to-Mysql-DB-using-Camel-Bindy-and-Camel-sql-got-stucked-tp5747812p5747830.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] 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
