camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: camel-sql - SQL IN Query issue (2.17.1)
Date Tue, 31 May 2016 05:44:14 GMT
See the documentation at
http://camel.apache.org/sql-component.html

The section:
Using IN queries with dynamic values

On Mon, May 30, 2016 at 10:09 PM, imranrazakhan <imranrazakhan@gmail.com> wrote:
> Hi,
>
> I am facing following error while using SQL IN clause
>
>     from("file://D:/Activity?fileName=BATCH_11.csv&noop=true")
>                  .split( body().tokenize( System.getProperty("line.separator") )
> ).streaming()
>                         .aggregate( constant(true), new ArrayListAggregationStrategy()
)
>                         .completionSize(1000)
>                  .to("sql:select status from subscriber where mobilenumber in
> (:#in:mobilenumbers)?dataSource=#oracleDS")
>                  .....
>                  .end();
>
> it gives error
>
> org.apache.camel.RuntimeExchangeException: Cannot find key [mobilenumbers]
> in message body or headers to use when setting named parameter in query
>
> I changed my route like below
>
> from("file://D:/Activity?fileName=BATCH_11.csv&noop=true")
>                  .split( body().tokenize( System.getProperty("line.separator") )
> ).streaming()
>                         .aggregate( constant(true), new ArrayListAggregationStrategy()
)
>                         .completionSize(1000)
>                  .setHeader("mobilenumbers", simple("${body}"))
>                  .to("sql:select status from subscriber where mobilenumber in
> (:#in:mobilenumbers)?dataSource=#oracleDS")
>
> Now facing following error
>
> org.springframework.jdbc.UncategorizedSQLException:
> PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state
> [null]; error code [0]; Number of parameters mismatch. Expected: 1, was:
> 1000; nested exception is java.sql.SQLException: Number of parameters
> mismatch. Expected: 1, was: 1000
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-sql-SQL-IN-Query-issue-2-17-1-tp5783264.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message