Peter
Peter

Reputation: 849

JDBC request with parameters is not working in Jmeter

I have one JDBC Connection configuration request, I am passing path of database from CSV file. In Database URL: I am passing jdbc:sqlite:${dbPath} but it is not working. I also had tried to put database value in User defined variables and passed in to the request but it didn't worked.

In my CSV file, dbPath = C:\Users\AppData\Roaming\aa\db_folder\database.db is declared also mentioned variable in CSV data set config.

enter image description here

enter image description here

If I pass same path directly to Database URL: then it works fine.

can anyone please suggest the solution. Thanks.

Upvotes: 0

Views: 30

Answers (1)

Ivan G
Ivan G

Reputation: 2707

Take a look at JMeter Test Elements Execution Order:

0. Configuration elements
1. Pre-Processors
2. Timers
3. Sampler
4. Post-Processors (unless SampleResult is null)
5. Assertions (unless SampleResult is null)
6. Listeners (unless SampleResult is null)

JDBC Connection Configuration is a Configuration Element therefore it will be evaluated before any Sampler which will trigger reading of the next line in your CSV file if you're using CSV Data Set Config

If you want to read the path to the sqlite database from the file - consider using a JMeter Function like __CSVRead(), __StringFromFile(), __FileToString() or __groovy()

Upvotes: 0

Related Questions