Hello, In camel-sql component you should use # sign instead of ? as question marks has its own meaning in URL notation.
Unfortunately it looks that you cannot really use # sign itself, as it will be converted to questionmark (so your '#' will become '?'). I'll create a a bug for this # sign problem. Roman 2010/6/10 mevikasg <[email protected]>: > > Hi, > > I am a newbie in Grails-Camel world. > > In my grails-groovy web application, i am trying to insert received messages > in mail account into db table using Camel SQL component. > > So far via my Route, i can easily access my mail messages and even can > perform SELECT queries on db as well. But, i am unable to Insert the > received messages in database. > > Route: > > > errorHandler(deadLetterChannel("mock:error")) > from("imaps://[email protected]&password=xxxx" > + > "&deleteProcessedMessages=false&processOnlyUnseenMessages=true&consumer.delay=600") > .process(new MyPro > http://old.nabble.com/file/p28841104/MyProcessorImpl.java > MyProcessorImpl.java cessorImpl()) > .to("sql:insert into message values > (?,'#',true,1)?dataSourceRef=myDataSource") > .to("activemq:queue:VIKAS") > .to("stream:out") > > > Its squealing following error: > > 2010-06-10 14:57:37,750 [Thread: 1 > org.apache.camel.component.mail.mailcompon...@1894800] ERROR > processor.DeadLetterChannel - Failed delivery for exchangeId: > ID-everest/1739-1276162039140/0-0. On delivery attempt: 0 caught: > org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > queues values (]; SQL state [S1009]; error code [0]; Parameter index out of > range (1 > number of parameters, which is 0).; nested exception is > java.sql.SQLException: Parameter index out of range (1 > number of > parameters, which is 0). > org.springframework.jdbc.UncategorizedSQLException: > PreparedStatementCallback; uncategorized SQLException for SQL [insert into > queues values (]; SQL state [S1009]; error code [0]; Parameter index out of > range (1 > number of parameters, which is 0).; nested exception is > java.sql.SQLException: Parameter index out of range (1 > number of > parameters, which is 0). > at > org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:96) > at > org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:257) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:477) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:489) > at > org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:45) > at > org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84) > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68) > at > org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87) > at > org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82) > at > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:189) > at > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:133) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:115) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:89) > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68) > at > org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87) > at > org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82) > at > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52) > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41) > at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66) > at > org.apache.camel.component.mail.MailConsumer.processMessage(MailConsumer.java:174) > at > org.apache.camel.component.mail.MailConsumer.processMessages(MailConsumer.java:156) > at > org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:105) > at > org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:66) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) > at > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.sql.SQLException: Parameter index out of range (1 > number > of parameters, which is 0). > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) > at > com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2777) > at > com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3608) > at > com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3010) > at > org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:52) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:460) > ... 30 more > > -- > View this message in context: > http://old.nabble.com/SQL-Component-%3A-Error-while-Inserting-record-in-db-table-tp28841104p28841104.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
