Reputation: 23522
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?
Upvotes: 1
Views: 1251
Reputation: 168217
For example you have a table with a CLOB field which looks like:
SQL> select * from sometable;
SOMEDATA
--------------------------------------------------------------------------------
hello
Which is returned to JMeter as something non-readable:
Declare a "Result Variable Name" with a meaningful reference name, i.e. clob
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)
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.
Upvotes: 3