#StackBounty: #java #jdbc #apache-camel How to safely generate SQL for Camel JDBC Component

Bounty: 50

I’m trying to make an insert with JDBC, and I’m looking at this example in the Camel docs: https://camel.apache.org/components/latest/jdbc-component.html#_using_named_parameters

But

.setBody("select * from projects where license = :?lic and id > :?min order by id")

Doesn’t compile.

The method setBody(Expression) in the type
ProcessorDefinition is not applicable for the
arguments (String)

You need to use simple() to shove a string into setBody(), but when I try that, the name parameters don’t work. We hit the ":" and it fails at runtime.

Am I misunderstanding how to specify these name parameters or is the doc wrong? How do we safely build an sql statement in Camel?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.