0

My test has 2 JDBC Requests.
I'd like to use the results of the first JDBC Request in the WHERE clause of the second JDBC request.

For example, querying a DB2 database, I have tried:

  1. JDBC Request 1: select member_id from Employees fetch first 1 row only
  2. JDBC Request 2: select bonus_amount from EmployeesBonuses where member_id = '${JDBC Request 1#ResponseAsXml#//MEMBER_ID}'

Unfortunately, this method of referencing doesn't work. Further, the 2 steps above reference different databases, so constructing a join'd statement is not possible.

rs79
  • 2,311
  • 2
  • 33
  • 39

1 Answers1

1

It is because Property Expansion does not work in sql query of Jdbc Request step.

Instead, have the query for 2nd as given below:

select bonus_amount from EmployeesBonuses where member_id = :MEMBERID

Above to the sql query, SoapUI allows to define the parameters. Define a parameter, MEMBERID and provide the value as Property Expansion i.e., ${#JDBC Request 1#ResponseAsXml#//MEMBER_ID}.

Now, try executing the query. For more details of query parameterization in SoapUI, refer documentation

Rao
  • 20,781
  • 11
  • 57
  • 77
  • 1
    This worked. Except that there is a small typo (originally in my question, itself). It should be '${JDBC Request 1#ResponseAsXml#//MEMBER_ID} - no # required before the step name. Thanks! – rs79 Jan 12 '18 at 16:49