How to use the "Result Variable Name" in a JDBC Request Jmeter Object

In JMeter, I added oracle server configuration. Then I added a JDBC query object and put the name of the ResultSet variable in status .
The test runs fine, and the result is displayed in the treeview listener.

I want to use the status variable and compare it with a string, but jmeter throws an error about passing arraylist to a string.

How to get this variable and compare it with a string in the While controller?

+4
source share
3 answers

The ResultSet variable returned by the JDBC query in JMeter is in the array argument. Therefore, if you want to use the status variable, you will have to use it with an index. If you want to use the first (or only) user record status_1 . Therefore you need to use it as status_{index} .

+4
source

Just used some time to figure this out and think that the accepted answer is a bit wrong, since the JDBC query sampler has two types of result variables.

Those that you specify in the Variable names field table for individual columns returned by your query, and you can access them by saying columnVariable_{index} .

The one you specify in the Result variable name contains the entire set of results, and in practice it is a list of maps for the values. The above syntax will obviously not work in this case.

+5
source
  String host = vars.getObject("status").get(0).get("option_value"); print(host); log.info("----- " + host); 

Read the yellow box in this link for the full information form: http://jmeter.apache.org/usermanual/component_reference.html#JDBC_Request

Another usage example: http://jmeter.apache.org/usermanual/build-db-test-plan.html

+2
source

Source: https://habr.com/ru/post/1486992/


All Articles