apache / apache/jmeter

Issue with JDBC Post Processor while saving the parameter value which contains special characters which typically exists in JSON response

Open
#5,379 9 comments 0 reactions 0 assignees View on GitHub
enhancement os: All P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**Andy** ([Bug 64651](https://bz.apache.org/bugzilla//show_bug.cgi?id=64651&redirect=false)):
Dear Sir,

I have the JSON from the prev response and trying to save it in the sql server database after cleaning it a little bit but JDBC Post Processor is internally seems to be splitting the response varchar string into many chunks as it may contains commas, dots, angled brackets, double slashes etc. I know it because for every JSON JDBC post processor is complaining that number of supplied arguments are more than specified in the input to JDBC db saving request. For every save request, the number of arguments are varying in the logs as complained by the jdbc processor. However, if I take the same string and go to sql server developer studio , I am able to save the string perfectly fine. So sql server accepts it but problem is in the jdbc post processor how it translates it to the jdbc driver, it seems that it is chopping the string into multiple requests.

so right now just to make it work, i had to use replace all on the json string to replace all characters to the simple string using below logic..

String responseJSON2BSaved = prev.getResponseDataAsString().replaceAll("[^a-zA-Z0-9=-></:.-]", "");
responseJSON2BSaved = responseJSON2BSaved.replaceAll(" ","");
responseJSON2BSaved = responseJSON2BSaved.replaceAll(":","");

//log.info("responseJSON2BSaved: " +responseJSON2BSaved);

vars.put("responseJSON2BSaved", responseJSON2BSaved);

This seems to be a bug in the jdbc processor. please advice, I would love to make it work where I can save the JSON into the database as whole it is without removing all its special characters.

OS: All

Contributor guide

Open the contributing guide

Research direction

Start with the JDBC Post Processor and reproduce the report using a JSON response containing commas, punctuation, and other special characters before saving it to SQL Server. Trace how the response variable becomes JDBC arguments; the issue is done when the complete value is passed as one argument and can be stored without stripping characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.