Send variable from one jdbc request to another jdbc request in JMeter

Viewed 106

In my test plan I have 3 JDBC connection request, from second request's response I want pass the variable to 3rd request, I tried with escape character and vars.get,

2nd Request for fetching group-transaction-id

enter image description here

3rd Request for fetching details using the group-transaction-id enter image description here

Tried with :

SELECT DISTINCT L.audit_context_key,K.event_log_value,L.event_log_id,L.event_logged_dttm FROM event_log L,event_log_keys K
WHERE L.audit_context_key LIKE 'vars.get('GROUP_TRANSID_1')%'
AND L.event_process='Interfaces/GenericPublishingService/StarterProcesses/GPFAdapterSubscriber.process'

also with

SELECT DISTINCT L.audit_context_key,K.event_log_value,L.event_log_id,L.event_logged_dttm FROM event_log L,event_log_keys K
WHERE L.audit_context_key LIKE '''vars.get('''GROUP_TRANSID_1''')%'''
AND L.event_process='Interfaces/GenericPublishingService/StarterProcesses/GPFAdapterSubscriber.process'

nothing is working

1 Answers

I guess you have your answer in your question,

first vars.get is scripting element which you cannot use in a query and second escape character will not work. So you need to pass it as parameter like in Jmeter,

SELECT DISTINCT L.audit_context_key,K.event_log_value,L.event_log_id,L.event_logged_dttm FROM event_log L,event_log_keys K
WHERE L.audit_context_key LIKE '${GROUP_TRANSID_1}%'

or if you really want to use vars.get then please use the following,

SELECT DISTINCT L.audit_context_key,K.event_log_value,L.event_log_id,L.event_logged_dttm FROM event_log L,event_log_keys K
    WHERE L.audit_context_key LIKE '${__groovy(vars.get('GROUP_TRANSID_1'),)}%'
Related