apache / apache/jmeter

jdbc sampler to run script (multiple statements)

Open
#6,467 0 comments 0 reactions 0 assignees View on GitHub
enhancement to-triage
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.