camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From imranrazakhan <imranrazak...@gmail.com>
Subject camel-sql - SQL IN Query issue (2.17.1)
Date Mon, 30 May 2016 20:09:11 GMT
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.

Mime
View raw message