You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Fabrizio Spataro (JIRA)" <ji...@apache.org> on 2016/07/18 09:18:20 UTC

[jira] [Commented] (CAMEL-10154) IN queries with dynamic values failure with multiple headers

    [ https://issues.apache.org/jira/browse/CAMEL-10154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381961#comment-15381961 ] 

Fabrizio Spataro commented on CAMEL-10154:
------------------------------------------

Thanks a lot!

> IN queries with dynamic values failure with multiple headers
> ------------------------------------------------------------
>
>                 Key: CAMEL-10154
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10154
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 2.17.2
>            Reporter: Fabrizio Spataro
>            Priority: Critical
>              Labels: sql
>
> Hello,
> I am using camel-sql component with IN dynamic parameter and found a bug with a query with more parameters.
> Summary, in my follow code i use 3 headers: user, company and MyRoles. SQLComponent not found all my headers.
> If i change my query using ONLY MyRoles header it is go fine!!!
> My Code is:
> {code:xml}
>    <setHeader headerName="CamelSqlQuery">
> 	<constant>SELECT * FROM role where user = :?user and company = :?company and role IN (:?in:MyRoles)</constant>
>    </setHeader>
>    <to uri="sql://MS?dataSource=mysql" />
> {code}
> Error:
> {quote}
> Caused by: java.sql.SQLException: Number of parameters mismatch. Expected: 3, was: 1
> 	at org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:153)
> 	at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:137)
> 	at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:107)
> 	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
> 	... 79 more
> , Out: null: 
> ]
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)