1

In Camel 2.17.0, camel sql component is not able to resolve property value using simple expression when externalized.

<route>
    <from uri="timer://foo?repeatCount=1" />
    <setProperty propertyName="column_name">
        <simple>1234</simple>
    </setProperty>
    <!-- could nto resolve property - failed ->
    <to uri="sql:{{sql.query}}" />
    <!-- working ->
    <to uri="sql:classpath:sql.query.sql?dataSource=#DS" />
</route>

External Properties file:

 sql.query = insert into table (column_name) values (:#${property.column_name})

Error Message:

Could not resolve placeholder 'property.column_name' in string value "sql:insert into table (column_name) values (:#${property.column_name})"

Dee_wab
  • 1,171
  • 1
  • 10
  • 23
  • 1
    Okay try with newer version. Camel 2.17.0 is EOL. – Claus Ibsen Apr 16 '18 at 08:13
  • 1
    this issue is observed even in camel 2.20.1 version Error Logs: java.lang.IllegalArgumentException: Could not resolve placeholder 'property.column_name' in string value "sql:insert into table (column_name) values (:#${property.column_name})" – Jayashankar Apr 16 '18 at 08:18
  • 1
    `to` endpoint does not support simple format. http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html – hk6279 Apr 16 '18 at 08:20
  • 1
    Well, I tried even using toD dynamic endpoint but same error – Jayashankar Apr 16 '18 at 08:24
  • 1
    Check simple format, property.foo is deprecated. http://camel.apache.org/simple.html – hk6279 Apr 16 '18 at 08:28
  • 1
    insert query is updated : insert into table (column_name) values (:#${exchangeProperty.column_name}) Error message: Could not resolve placeholder 'exchangeProperty.column_name' in string value – Jayashankar Apr 16 '18 at 08:30
  • 1
    Use `$simple{}` syntax, see TIP of this page: https://github.com/apache/camel/blob/master/camel-core/src/main/docs/simple-language.adoc – Claus Ibsen Apr 16 '18 at 10:06
  • 1
    Try setting `{{sql.query}}` in header or body and pass it to `to uri` – Lucifer Apr 16 '18 at 10:39
  • 1
    even {{sql.query}} did not work. We need to add External Properties file: sql.query = insert into table (column_name) values (:#$simple{property.column_name}) :#$simple{property.value} - this will work but document is not update as mentioned above – Jayashankar Apr 16 '18 at 10:52

0 Answers0