Search code examples
jmeter

Jmeter JDBC can't accessed the csv because it is used by other process


I have a Jmeter Test Plan with below configuration

TestPlan
Trgr1
Trgr2
Trgr3

ThearDown - excluded from summary report with prev.setIgnore()

summaryResult - file path is provided to save csv file with the report

I run the tests and got the csv file saved on a given location. After in thear down i have an jdbc with purpose to create table in the database and populate there the data from csv with BULK Insert.

Problem: JDBC can't accessed the csv because it is used by other process. It is released just after all test completed and jdbc request from thread group fail. The process cannot access the file because it is being used by another process.).

Is there solution for this? I tried with timer in order to simulate delay in tear down but issue remain


Solution

  • I don't think your approach is good enough mainly because you don't have any guarantee that the CSV file will contain full metrics.

    I would rather recommend going for one of the following options:

    1. Set jmeter.save.saveservice.autoflush property to true and use .jtl results file instead of the one from the Summary Report listener
    2. Or come up with your own Backend Listener implementation which will be sending the metrics into the relational database. See How to Develop a JMeter Plugin: Intro & Best Practices for more information on creating JMeter Plugins.