Fabrizio Spataro created CAMEL-10154:
----------------------------------------

             Summary: 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


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)

Reply via email to