0

I am using CSV data config as input file in that I have HTTP request parameters stored. After hitting HTTP Request I am using JDBC request to retrieve the result from the database for same http request.

How can I store the Response data getting from JDBC request into csv. As I need to store in csv the input parameter and the response data . Is there any way where I can store it? Below is the JDBC request the result value I want to store in front of input data

JDBC Request

JDBC Response

Madhu
  • 367
  • 2
  • 7
  • 20

1 Answers1

0

If you are getting a single value as a result you can put something like RESULT into the "Variable Names" section

JDBC JMeter Result

After that you have 2 options:

  1. Append these 2 Variables values to JMeter .jtl results file (recommended). To do this add the next line to user.properties file:

    sample_variables=TRANSACTION_ID,RESULT_1
    

    See Sample Variables User Manual section for more details

  2. Write the files to a new CSV file. In that case you will need to add JSR223 PostProcessor and the code like (assumes Groovy language):

    def csvFile = new File("file.csv")
    
    csvFile << vars.get("TRANSACTION_ID")
    csvFile << ","
    csvFile << vars.get("RESULT_1")
    csvFile << System.getProperty("line.separator")
    

Check out Debugging JDBC Sampler Results in JMeter article to learn more about working with the JMeter's JDBC Test Elements results and result sets.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Hey @Dmitri, Thank you for the response. I tried the first option and I see transaction ID got populated correctly but RESULT_1 is coming out as NULL.. Can you please suggest why it is so? – Madhu Jan 05 '17 at 04:02
  • Maybe database query returns NULL? – Dmitri T Jan 05 '17 at 06:15
  • @dimitriT Actually I see the response in the response data field for the scenario. I wanted to attach an image to show you the response but I am not able attach here so I edited the question and there is JDBC RESPONSE link. Can you please take a look.. its in json format. the data is from database itself – Madhu Jan 06 '17 at 04:36
  • Hey @Dmitri , Can you please see my above comment ? Please let me know about this. – Madhu Jan 08 '17 at 00:02