Dynamic query doesn't work in sql component

Solution Verified - Updated -

Issue

I am building query parameter based on URI Query but when executing the SQL query it gives me an error message like below:

017-05-15 17:25:22,483 | ERROR | qtp273057834-80  | DefaultErrorHandler              | 135 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Failed delivery for (MessageId: ID-WEL3607-61358-1494832966974-2-15 on ExchangeId: ID-WEL3607-61358-1494832966974-2-14). Exhausted after delivery attempt: 1 caught: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; The value is not set for the parameter number 1.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 1

I am using below query in my SQL component:

SELECT * from Table where :#${body}

>> where the value for ${body} = " Model like%TestModel%"

Environment

  • Red Hat JBoss Fuse
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.