jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

jdbc sampler to run script (multiple statements)

Open nutmix opened this issue 6 months ago • 0 comments

Use case

  1. Often we need to run many statements (e.g. to drop then create the tables, indexes and keys needed by a test) Splitting each of these into individual samplers is tedious and doesn't help in that they either all work or all fail.
  2. Inserting lots of static data ready for a testing is something which really needs the ability to run as a script (i.e. all the inserts in a single sampler).
  3. combine dependent inserts (i.e those joined by foreign key) into one transaction and sampler). E.g. a user and their address.

Possible solution

a new sampler called "JDBC Script Request", which can execute any number of statements pasted into the "Script" window (which is more or less the same as the "Query" window). Ideally a check box to run the script in a separate transaction, with an auto rollback after completion (i.e. we would need to add a commit; statement as the last line of the script, in which case the rollback does nothing. that way if one statement fails, they all fail (and get rolled back).

Possible workarounds

No response

JMeter Version

5.6.3

Java Version

21 (zulu)

OS Version

win 11

nutmix avatar Jul 09 '25 09:07 nutmix