Reputation: 982
To proceed with a Database validation, I am having a need of comparing a record in the DB along with a data which is dynamically generated in the previous REST response, using SoapUI
.
I have already captured the property value using a Property Transfer
step and stored the required value in a custom property in Test-Case successfully i.e., using property expansion, say ${TestCase#customerId}
My intention is to use that particular value stored in the custom properties to query the result I am expecting, in the JDBC Request
test step.
The query which I have drafted with the parameter is as below :
Select *
From ABC.SEC_CUST
Where ABC.SEC_CUST.CUSTOMER_ID = ${TestCase#customerId}
The response I receive after executing is as below.
Error getting response; java.sql.SQLSyntaxErrorException : ORA-00911: Invalid character.
But, when I run the query without the parameterized value it executes perfectly. Where, I tend the conclusion as there is a syntax issue in the way I have mentioned the parameter in the query.
But, I am unable to find the correct way to mention the parameter in the query in SoapUI.
Can anyone with experience in SoapUI, please assist me on this?
Upvotes: 3
Views: 6185
Reputation: 949
Like mentioned by others you simply forgot a '#' in the parameter name.
To avoid such mistakes use the built-in context menu of the "SQL Query" text field. It has a menu entry called "Get Data..." which lets you insert all known properties into the SQL statement.
Upvotes: 0
Reputation: 106
You forgot a '#'
Select *
From ABC.SEC_CUST
Where ABC.SEC_CUST.CUSTOMER_ID = ${#TestCase#customerId}
Upvotes: 2
Reputation: 21389
That is not working because of the use of property expansion which is only known to SoapUI
, but not for the SQL query
.
In order to get it work for the same, you need to define the variables in the top for all the parameters that are going to be used in the sql query.
Here the screen shot which explains how to use the same:
Upvotes: 7
Reputation: 407
Try this.
Select * From ABC.SEC_CUST
Where ABC.SEC_CUST.CUSTOMER_ID = :customerId
Upvotes: 0