0
votes

How to get CSV results without getting the column name (reading from jdbc request) in Jmeter.

Jdbc request: select query is present it fetches the values to a variable. -- under this we have JSR223 sampler which prints variable values to CSV file.

Thank u, Mahadev S

1

1 Answers

0
votes
  1. Add JSR223 PostProcessor as a child of the JDBC Request sampler
  2. Put the following code into "Script" area:

    def result = vars.getObject('result') 
    def file = new File('foo.csv') 
    result.each { subresult ->
        subresult.values().each { value ->
            file << value << ','
        }
        file << System.getProperty('line.separator')
    }
    
    • replace result with what you have as the "Result variable name" in the JDBC Request sampler
    • replace foo.csv with the desired location of the CSV file
  3. That's it, you will have the JDBC Request sampler output in form of table written to the CSV file. Check out Debugging JDBC Sampler Results in JMeter article for more information on working with JDBC result sets if needed.