2

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?

Apu
  • 147
  • 1
  • 4
  • 12

1 Answers1

2

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:

JMeter Properties in JDBC Connection Configuration

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.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133