0

I specified an endpoint containing a URI for a sql component as:

<endpoint id="select-myS" uri="sql:select myField from myView where ChangeDate between :#startDate and :#endDate"/>

I am setting startDate and endDate as headers. In that case I receive the error message as: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'between'

If I try to avoid between, and add two clauses as below: ChangeDate >= :#startDate and ChangeDate <= :#endDate, I receive other error: The value of attribute "uri" associated with an element type "null" must not contain the '<' character

(I also tried :#endDate>=ChangeDate , and it also not work! :-( ).

Could you please advise on this?

Thank you!

ThaisK
  • 365
  • 1
  • 4
  • 22

1 Answers1

0

As you're using XML to describe your route and endpoints, you have to escape your '>' and '<'chars, eg:

> should be escaped as &gt; (aka greather than)
< should be escaped as &lt; (aka lower than)

Which gives:

<endpoint uri="sql:... where ChangeDate &gt;= :#startDate and ChangeDate &lt;= :#endDate">
TacheDeChoco
  • 3,683
  • 1
  • 14
  • 17