0
votes

Test Plan Thread Group JDBC Connection JSR223 Sampler JDBC Request Result Tree

Put codes in the JSR223 Sampler:

int id = Integer.parseInt( vars.get("party_id") ); vars.putObject("id", new Integer(id));

Then use id in JDBC Request:

    select * from table where column = ? 
    Parameter Value: ${id}
    parameter Type: NUMBER

It seems the JDBC request is ignored and no output shown in the result tree.

Please help to look into the issue...

Thanks in advance

2

2 Answers

0
votes

User Defined Variable stores value of String but not Integer. I wonder if there is any error/warning in JMeter console (log).

Cast you integer to String to put it into UDV. enter image description here

Just specify ${UDV} if you wanted it to be an integer. Add quotes ('$UDV') if you want it as varchar in SQL query enter image description here

enter image description here

0
votes

Have reproduced your problem, it looks like that JDBC Sampler doesn't accept integers, only Strings.

I'm getting following error in jmeter.log, guess you too:

2014/01/04 11:30:14 ERROR - jmeter.threads.JMeterThread: Error while processing sampler 'JDBC Request' : java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

So your cast to integer is absolutely not required. Try changing your JSR223 code to following:

vars.put("id", vars.get("party_id")); 

It should work fine.

The bit, which tells MySQL which datatype bind the variable to is ParameterType stanza. You need to specify paratemer type there, not in JSR223