How to get object result set from JDBC Sampler in JMeter

孤人 提交于 2019-11-30 15:45:47

Beanshell is not Java, you need to access it a little bit differently.

Those "diamond" brackets are not very supported by Beanshell. Please amend your code as follows:

ArrayList result = vars.getObject("resultList");
for (HashMap table : result) {
    for (Object column : table.keySet()) {
        log.info(column + "=" + table.get(column));
    }
}

The code above assumes that you have set resultList as a "Result Variable Name" in your JDBC Request Sampler.

That should print query result into jmeter.log file.

See How to use BeanShell guide for more details and kind of Beanshell cookbook.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!