0
  1. set variable names on jdbc preprocessor.
    variable names : aa,bb
  1. excute query
    select aa, bb from table; 
  1. try to get the variable names on jsr223 preprocessor
   log.info(vars.get("aa"));

but this via aa is null

how to use variable names?

1 Answers1

0

Looking into JDBC Request Sampler documentation:

If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C, then the following variables will be set up:

A_#=2 (number of rows)
A_1=column 1, row 1
A_2=column 1, row 2
C_#=2 (number of rows)
C_1=column 3, row 1
C_2=column 3, row 2

So it will be:

  • vars.get('aa_1') - for first row of the aa column
  • vars.get('aa_2') - for second row of the aa column
  • vars.get('bb_1') - for first row of the bb column
  • etc.

More information: Debugging JDBC Sampler Results in JMeter

Dmitri T
  • 159,985
  • 5
  • 83
  • 133