I'm running Camel 2.17.2.

I've been experiencing a problem when using IN query in a SQL statement
where there is more than one parameter, besides the one declared within the
IN clause. For example:

.to("SELECT * FROM projects WHERE license = :#${body} AND project IN
(:#in:names)")

Caused by: java.sql.SQLException: Number of parameters mismatch. Expected:
3, was: 2
        at
org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:153)
        at
org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:146)
        at
org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:116)
        at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
        ... 54 more

I've noticed someone already mentioned this in another recent thread, but I
don't find this specific issue being considered there.

I forked Camel, created a test case that reproduces the problem and pushed
in a branch here:

https://github.com/juliaaano/camel/tree/sql-in-multiple-params

Do you guys consider this to be a bug? I'd be happy to report and submit a
pull request with the fix.

I suspect the problem is around
org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.NamedQueryParser
in the next() method.

Please let me know how I can help. I'd love to contribute.

Thanks.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-sql-IN-query-number-of-parameters-mismatch-tp5785054.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to