Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10154

IN queries with dynamic values failure with multiple headers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.17.2
    • Fix Version/s: None
    • Component/s: camel-sql
    • Labels:
    • Estimated Complexity:
      Unknown

      Description

      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:

         <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" />
      

      Error:

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              fabryprog Fabrizio Spataro
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: