Hi, Looks like the same issue was discussed in this ML a month ago :-) http://camel.465427.n5.nabble.com/camel-sql-SQL-IN-Query-issue-2-17-1-td5783264.html
Isn't it the same as yours? For convenience, Claus suggested the following solution in that thread: > I wonder if its the Oracle JDBC driver issue, that it does not return > correct value for number of parameters in the prepared statement. > > There is an option parametersCount you can use to set a fixed value if > the JDBC driver cannot return correct data. See its documentation > http://camel.apache.org/sql-component.html > > However that value is fixed, and if you use a dynamic IN list then you > would need to use <toD> to make the uri dynamic. (less good but > possible). But at least maybe try to set that value = 1000 as you use > in your example, and see if that at least work. On Wed, Jul 13, 2016 at 1:29 AM, juliaaano <juliaa...@gmail.com> wrote: > 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. >