Bug 57322

Summary: JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Product: JMeter - Now in Github Reporter: Yngvi Þór Sigurjónsson <blitzkopf>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: enhancement CC: p.mouawad
Priority: P2 Keywords: PatchAvailable
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch to add ResultSet returned from Callable Statements.

Description Yngvi Þór Sigurjónsson 2014-12-07 00:51:35 UTC
Created attachment 32265 [details]
Patch to add ResultSet returned from Callable Statements.

In Oracle it is a common practice to return queries from stored procedures as a construct called refcursor. Refcursors are then returned as ResultSets to Java and if you really want to do thorough load test you actually have to loop through the whole result set. The current code does not iterate through those ResultSet and stores the ResultSet as string so it is not possible to do any further processing on it. If the ResultSet is stored as a Object they can actually be iterated in JSR223 of BeanShell script. It would also be nice if the JDBC sampler would actually just iterate through the RS by itself.

Attached is a patch for your consideration, that adds the code and configuration options for dealing with ResultSets : Store as String, Store as Object, and Count Records. 

Regards 
Yngvi
Comment 1 Philippe Mouawad 2014-12-15 20:51:49 UTC
Date: Mon Dec 15 20:47:22 2014
New Revision: 1645746

URL: http://svn.apache.org/r1645746
Log:
Bug 57322 - JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Bugzilla Id: 57322

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/JDBCTestElementBeanInfoSupport.java
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPostProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPreProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSamplerResources.properties
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
Comment 2 Philippe Mouawad 2014-12-15 20:53:42 UTC
Hello,
Thanks for contribution.
I commited code with a fix to the count of rows as I think there was a bug in :
                            else if( RS_COUNT_RECORDS.equals(resultSetHandler))

270 	

                                jmvars.put(name,o.toString()+" "+((java.sql.ResultSet)o).getRow()+" rows");

It would be great to test nightly build and tell us if it works for you as you wanted it to .

Thanks
Regards
Philippe M.
@philmdot
Comment 3 Philippe Mouawad 2014-12-15 21:04:26 UTC
Date: Mon Dec 15 21:03:31 2014
New Revision: 1645749

URL: http://svn.apache.org/r1645749
Log:
Bug 57322 - JDBC: add methods to deal with ResultSets(cursors) returned by callable statements
Add missing FR translations
Bugzilla Id: 57322

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPostProcessorResources.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/processor/JDBCPreProcessorResources_fr.properties
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSamplerResources_fr.properties
Comment 4 The ASF infrastructure team 2022-09-24 20:37:58 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3497