Reputation: 165
My Environment: JMeter v2.11, Oracle 12, JDK 7
I have a Jmeter thread in which I'm trying to pass a value from one JDBC Request sampler to another JDBC Request sampler, but when the second JDBC request runs, the result is blank.
I've confirmed the SQL is fine by 1. running the SQL in Oracle Developer, data is returned successfully
I've also confirmed that if I specify the value in Jmeter rather than have it source the value from the 1st sampler - the query returns the result fine
My workings:
JDBC Request 1 --> Query Type: Select Statement
select max(appid) from table; Variablename --> appid
JDBC Request 2 --> Query Type: Prepared Select Statement
select datevalue from table1
inner join table2 on table1.id = table2.id where value = ?;
ParameterValue = ${appid}, ParameterType = VARCHAR
When I run the both the JDBC Request Samplers - they both report in the View Results Tree Listener successful execution, JDBC Request 1 returns a value in the Response Data, but the result for JDBC Request 2 is blank (value returned is just the datevalue column).
I ran the JDBC Request 2 on its own, it generated the blank result as one would expect after thinking about it - leading me to believe that I'm not successfully passing the ${appid} value from JDBC Request 1 to JDBC Request 2 successfully.
Can anyone please advise what I'm doing wrong? Or perhaps another method to pass a value from one JDBC Request to another?
I've had a look around and found posts regarding passing values from JDBC to HTTP Requests and also found some very helpful posts (which got me this far), but nothing exactly fitting the scenario I need.
Again, as with all my posts, I am grateful for all advice/help etc.
Cheers
Upvotes: 1
Views: 1723
Reputation: 165
Sorry for wasting everybody's time. I found the problem.
The ParameterValue value was incorrect. The value needed to be ${appid_1} (NOTE the 'underscore 1' ('_1') value.
Once I changed ${appid} to ${appid_1} the results on the second JDBC Request were correctly populated.
Upvotes: 1