Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-5556

Number of parameters mismatch if using IN queries with dynamic values and Oracle DB

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • jboss-fuse-6.3
    • jboss-fuse-6.3
    • Camel
    • None
    • % %
    • Hide

      Camel route:

      <route>
          <from uri="direct:selectProjectsInExpression"/>
          <to uri="sql:select * from projects where project in (:#in:${header.names}) order by id"/>
          <to uri="mock:projectsInExpression"/>
      </route>
      

      I send message with header names into route.

      template.requestBodyAndHeader("direct:selectProjectsInExpression", "Hi there!", "names", "Camel,AMQ");
      
      Show
      Camel route: <route> <from uri= "direct:selectProjectsInExpression" /> <to uri= "sql:select * from projects where project in (:#in:${header.names}) order by id" /> <to uri= "mock:projectsInExpression" /> </route> I send message with header names into route. template.requestBodyAndHeader( "direct:selectProjectsInExpression" , "Hi there!" , "names" , "Camel,AMQ" );

      Combination of camel-sql component IN queries with dynamic values and Oracle jdbc driver cannot correctly resolve parameters of SQL.

      Exception:

      Caused by: java.sql.SQLException: Number of parameters mismatch. Expected: 1, was: 2
      	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:589)
      	... 173 more
      

            Unassigned Unassigned
            tturek@redhat.com Tomas Turek
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: