You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sayed_india <sa...@gmail.com> on 2014/09/08 20:19:42 UTC
Re: Route Camel : Pass variables in a SQL query
Hello,
I tried the below code and able to print the id, but not able to get the
required query.
Please correct the code:
<when>
<simple>${header.operationName} == 'getCompany'</simple>
<setHeader headerName='id'>
<simple>$simple{body}</simple>
</setHeader>
<log id="log1" message ="param name---:${in.header.id}" />
<to uri="sql:SELECT * from company where id = :#id"/>
</when>
Thanks,
--
View this message in context: http://camel.465427.n5.nabble.com/Route-Camel-Pass-variables-in-a-SQL-query-tp477181p5756205.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Route Camel : Pass variables in a SQL query
Posted by Charles Moulliard <ch...@gmail.com>.
The header to be used to log the query is named 'CamelSqlQuery'. See the
doc here : http://camel.apache.org/sql-component.html`
<to uri="sql:SELECT * from company where id = :#id"/>
<log message="Query : $header. CamelSqlQuery}" />
On Mon, Sep 8, 2014 at 8:19 PM, sayed_india <sa...@gmail.com>
wrote:
> Hello,
>
> I tried the below code and able to print the id, but not able to get the
> required query.
>
> Please correct the code:
>
> <when>
> <simple>${header.operationName} == 'getCompany'</simple>
> <setHeader headerName='id'>
> <simple>$simple{body}</simple>
> </setHeader>
> <log id="log1" message ="param name---:${in.header.id}" />
> <to uri="sql:SELECT * from company where id = :#id"/>
> </when>
>
> Thanks,
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Route-Camel-Pass-variables-in-a-SQL-query-tp477181p5756205.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Route Camel : Pass variables in a SQL query
Posted by sayed_india <sa...@gmail.com>.
Thanks for the response.
My question am not able to get the id param value in the SQL query throws
error as invalid SQL query as the :id is not replaced with the value.
Best regards,
Sayed
--
View this message in context: http://camel.465427.n5.nabble.com/Route-Camel-Pass-variables-in-a-SQL-query-tp477181p5757759.html
Sent from the Camel - Users mailing list archive at Nabble.com.