Reputation: 177
I am trying to get the datatbase url, password and username from a csv file in the JDBC configuration. The post JDBC requests and query DB.
The main moto is not to touch the .jmx test plan and provide values externally.
How can I do this?
Upvotes: 2
Views: 1597
Reputation: 168162
JDBC Connection Configuration is a configuration element therefore it is being executed before any JMeter Variables are initialised.
So the easiest option would be setting url and credentials using __P() function like:
Once done you will be able either to set the properties value in user.properties file (lives in "bin" folder of your JMeter installation) like:
url=jdbc:mysql://localhost:3306/dbname
username=root
password=secret
Or define them through -J
command-line option:
jmeter -Jurl=jdbc:mysql://localhost:3306/dbname -Jusername=root -Jpassword=secret -n -t test.jmx -l result.jtl
More information:
If you have to use the CSV file you can go for __CSVRead() function, in this case you can get first entry in the csv file as ${__CSVRead(test.csv,0)}
, second as ${__CSVRead(test.csv,1)}
, etc.
Upvotes: 2