Devon Lindsay
Devon Lindsay

Reputation: 21

Using JMETER GUI JDBC Request with Callable Statement – how do I getResultSet/MetaData?

I’ve got a call to my database working as a SQL select statement. But I am working to call a stored procedure using JMeter for further testing. I’m strictly working off of the JMX files and do not have JMETER integrated into our main Java project at this time.

I’ve setup the JMETER GUI with the JDBC Connection Configuration and the JDBC Request. I’ve made a successful call to my database with my callable statement with my string INPUT and get the string OUTPUT parameter string.

The OUTPUT parameter string only contains information about the call (user,system, success, etc…), but none of the values/data from the table -- which are found in the ResultSet/MetaData. But I cannot figure out how to get the ResultSet or the Metadata using the JDBC Request in JMETER.

In Java, I know I use the statement and just call statement.getResultSet() and perform a loop while resultSet.next() exists. How do I do this in JMETER?

I've tried adding an additional out parameter but then my statement rejects the call, because there is only one in-parameter. I've tried a variety of JMeter Assertions - but because the main call is only returning the out parameter, I cannot grab additional data.

Query: call XXXXX.readUser(?)

Parameter Values: ${inputJSONString}

Parameter Types: INOUT VARCHAR

Variable Names: ouputJSONString

Result Variable Name: ouputJSONString

View Results Tree: Response code: 200, Response message: OK, Output variables by position: Contains the whole JSON out parameter string with user, system, and success. Returns the table column headers but no values.

I do not have errors - the call is being made successfully. I just cannot figure out how to access the Result Set from JMETER.

Upvotes: 2

Views: 1624

Answers (1)

Dmitri T
Dmitri T

Reputation: 168197

Don't use the same reference name for the Variable Names and the Result Variable Name as the latter one will be overwritten.

So

  1. Change ouputJSONString to i.e. ouputJSONStringObject
  2. Add JSR223 PostProcessor as the child of the request
  3. You will be able to access the JMeter's representation of the ResultSet as vars.getObject('ouputJSONStringObject') (basically ArrayList of HashMaps

See Debugging JDBC Sampler Results in JMeter article for more details.

Unfortunately you cannot access the normal ResultSet as it is not exposed anywhere and being converted via private function

Upvotes: 0

Related Questions