JMeter:变量中的数据库Clob [英] JMeter: database clob in variable

查看:371
本文介绍了JMeter:变量中的数据库Clob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JDBC示例,它在一个变量内选择oracle clob.但是,我需要在HTTP请求中使用此变量的内容,但是变量扩展不会评估clob的内容,而是名称.如果我尝试在SQL查询中将Clob转换为to_char,我将得到一个错误缓冲区大小太小.如何在jmeter中将Clob正确转换为字符串?

I have JDBC sample which selects oracle clob inside a variable. However, I need to use the content of this variable in the HTTP request, but the variable expansion doesn't evaluate to clob's content, but it's name instead. If I try to cast the clob to_char in the SQL query, I get an error buffer size is too small. How to correctly convert clob to string in jmeter?

推荐答案

  1. 例如,您有一个带有

  2. 将其中哪些内容作为不可读的内容返回给JMeter:

  3. Which is returned to JMeter as something non-readable:

    使用有意义的引用名称(即clob

    Declare a "Result Variable Name" with a meaningful reference name, i.e. clob

    JSR223后处理器添加为JDBC请求的子代采样器,并将以下代码放入脚本"区域:

    Add JSR223 PostProcessor as a child of the JDBC Request sampler and put the following code into "Script" area:

    def data = vars.getObject('clob').get(0).get('SOMEDATA')?.characterStream?.text
    log.info('Value from CLOB field: ' + data)
    

    上面的代码将从CLOB字段中提取值并将其打印到 jmeter.log 文件

    The above code will extract the value from the CLOB field and print it into jmeter.log file

    答案受文章.

    The answer is inspired by the Performance Testing BLOB from a MySQL Database with JMeter article.

    这篇关于JMeter:变量中的数据库Clob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆