Computer_Resear
16 years agoOccasional Contributor
Re: Datasource query property expansion errors.
I have created a datasource step to execute the following sql:
select *
from aTable
where column1 = '777'
and column2 = ${="'" + ${Properties#theProperty} + "'"}
I created a properties step called "Properties" which has a property called theProperty with a value B. We are trying to add single quote to the property value.
I get the following exceptions:
groovy.lang.MissingPropertyException: No such property: B for class: Script1
It seems to be misinterpreting the property value of B as the property name. This generates the following exception,
java.sql.SQLException: [SQL0104] Token SUCH was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE. Cause . . . . . : A syntax error was detected at token SUCH. Token SUCH is not a valid token. A partial list of valid tokens is FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token SUCH. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is, correct the SQL statement because it does not end with a valid clause.
We have done this in the past and it works in the datasource step. Please advice.
Thanks,
Srini
select *
from aTable
where column1 = '777'
and column2 = ${="'" + ${Properties#theProperty} + "'"}
I created a properties step called "Properties" which has a property called theProperty with a value B. We are trying to add single quote to the property value.
I get the following exceptions:
groovy.lang.MissingPropertyException: No such property: B for class: Script1
It seems to be misinterpreting the property value of B as the property name. This generates the following exception,
java.sql.SQLException: [SQL0104] Token SUCH was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE. Cause . . . . . : A syntax error was detected at token SUCH. Token SUCH is not a valid token. A partial list of valid tokens is FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token SUCH. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is
We have done this in the past and it works in the datasource step. Please advice.
Thanks,
Srini