sqeeky
sqeeky

Reputation: 165

JMeter - Passing MULTIPLE values From 1 JDBC to Another JDBC

Environment: JMeter v2.11, Oracle 12, JDK 7

I need to pass 2 values from one JDBC Request sampler to another. I've followed previous posts and the Jmeter help but the second variable value is not being used by the 2nd JDBC Request samplers query, despite the fact that I can see both values are successfully passed.

My workings are as follows:

Thread Group: Number of Users-->1, Loop Count-->1
-JDBC Request_1: select appid from (select appid from tableZ order by appid desc) where rownum<= 2;    
VariableName: appid

JDBC Request_2: select A.date, B.appid, A.status from tableA A
inner join TableB on A.id = B.id
where A.status in ('Start', 'End')
and B.appid in (?,?); 
ParameterName: ${appid_1}, ${appid_2}, ParameterType: VARCHAR, VARCHAR

JDBC Request_1 returns 2 appid's ('0001' and '0002') for it's result - so {appid_1} = '0001' and {appid_2} = '0002'

JDBC Request_2 request is as follows:

select A.date, B.appid, A.status from tableA A
inner join TableB on A.id = B.id
where A.status in ('Start', 'End')
and B.appid in (?,?)
0001, 0002
VARCHAR, VARCHAR

So you can see it appears the variables are passed successfully from JDBC Request_1 to Request_2 here (note the values '0001, 0002' above) but Request_2 executes and the response is as follows:

DATE        APPID   NODENAME
2015-03-20  0001    Start
2015-03-20  0001    End

That is - the query only executes for the variable/parameter {appid_1} and not for {appid_2} (which is the second comma separated variable) - Can anyone suggest what I'm doing wrong?

The query executes with no problems in Oracle SQL Developer so I've proved the SQL is fine - and that I'm rubbish at using JMeter!

As I mention above - I've had a look around, trial and error, and read the help - but I just cannot see what I am doing wrong.

Thanks for any hints/tips anyone might have!

Upvotes: 0

Views: 2091

Answers (1)

sqeeky
sqeeky

Reputation: 165

finally worked out the answer.

If there is a space between the comma of the preceeding ParameterName value and the next ParameterName value, the next ParameterName is NOT included in the subsequent query

  • i.e. do NOT have any whitespace after the comma separating the parm names so instead of '${appid_1}, ${appid_2}' (where you can see there is a space separating the ParameterName values, specify ${appid_1},${appid_2} instead as the values in the ParameterName list - otherwise in this example ${appid_2} won't be included.

Upvotes: 1

Related Questions