3

We have common testing machine due to the security reasons one tester should not see the other tester's jdbc configuration details in the sampler as there is a chance to misuse username and password and other details.

1.Is there any way to set system variables for different jdbc connection configurations for multiple databases such as MySQL,DB2 and Microsoft SQL. Ex : Application X uses Microsoft SQL where as application Y uses DB2 and application Z uses MySQL . Y and Z are integration layers. Variables for Database URL, JDBC Driver class,Username,Password.Please provide the example.

2.Tester need to run the #1 via command line before test starts how to do that?what are the command lines?.Please provide the example.

3.In JDBC request instead of hard coding the sql scripts how to send the SQL scripts path which may contain bunch of SQL scripts or single SQL script. .Please provide the example.

I have tried the below as showed in the screenshots, but always return results for the only sql query only, but when looked at the sampler request i see all the queries sent,but response is only for the 1st query.

enter image description here

enter image description here

enter image description here

4.For Distributed testing any special care required for the above..Please provide the example.

How can I achieve #1 ,#2 ,#3 and # 4.

enter image description here

enter image description here

enter image description here enter image description here

Below are the Latest Screenshots For #1 and # 2 below are the screenshots enter image description here

enter image description here

For #3 below are the screenshots

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Thanks, Raj

rpagadala
  • 796
  • 2
  • 15
  • 31

2 Answers2

0

Each user can send different properties in command line (-JdbUser) or using property file.

Define each dynamic parameter as dbUser as a property ${dbUser} so each user will have different connection.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • I have tried #3 but only very 1st sql query from the file executed.When I looked at the request of jdbc sample request is going fine,but returned response only 1st query for rest of them nothing(see the screenshots to the original post).Could you please elaborate little bit on #1 and please provide full command by giving an example. – rpagadala Sep 08 '17 at 19:45
  • I have figured it out #1 and #2.Could some one please help me on #3 as i mentioned always only 1st SQL query returning the result though Jdbc request successfully able to read all the list of SQL queries from file. – rpagadala Sep 09 '17 at 05:15
0
  1. You can access operating system Environment Variables using i.e. __groovy function like

    ${__groovy(System.getenv('DB2_PASSWORD'),)}
    
  2. Depending on your operating system, i.e:

    • for Windows family the command line would be something like: set DB2_PASSWORD=secret
    • for Unix family it would be: DB2_PASSWORD=secret && export DB2_PASSWORD
  3. The easiest way will be using Directory Listing Config Plugin

  4. As per Remote Testing User Manual Entry:

    If the test uses any data files, note that these are not sent across by the client so make sure that these are available in the appropriate directory on each server. If necessary you can define different values for properties by editing the user.properties or system.properties files on each server. These properties will be picked up when the server is started and may be used in the test plan to affect its behaviour (e.g. connecting to a different remote server). Alternatively use different content in any datafiles used by the test (e.g. if each server must use unique ids, divide these between the data files)

    JMeter slaves are absolutely independent so you will need to do the same environment variables setting, copy your JDBC Drivers and SQL scripts, make configuration changes if needed, etc. on each slave,

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I have used Property File Reader for #1 and #2 and jdbc connection works fine.For #3 i have created 5 csv file for each SQL query and when i execute it executes only 1 csv file and throws error.I am not sure may me i am doing mix or wrongly using Directly Listing Data Source plugin to execute SQL queries.Please see the Below are the Latest Screenshots section i have added to the original post.Please advise me. – rpagadala Sep 11 '17 at 21:01
  • Directory Listing Data Source will get only the name of the file, you will need to use [__FileToString() function](https://www.blazemeter.com/blog/how-use-jmeter-functions-part-iii) in order to read the query from the file like `${__FileToString(${filename},,)}` – Dmitri T Sep 12 '17 at 04:14
  • I have kept 5 Sql queries in one file,and Listing of directory successfully finished, 1 files found: ${filename} = C:\JMETER\LR2JMeter\NGP\Scripts\Database\NGP_Database.csv and passed ${__FileToString(${filename},,)} in the jdbc request . Request ran 5 sql queries successfully but always returns the results for the 1st sql query only. – rpagadala Sep 12 '17 at 23:44
  • If you have 5 sql queries in a single file you need to go for [__StringFromFile()](https://jmeter.apache.org/usermanual/functions.html#__StringFromFile) or [CSVRead()](https://jmeter.apache.org/usermanual/functions.html#__CSVRead) functions – Dmitri T Sep 13 '17 at 04:06
  • I have tried all these ${__StringFromFile(C:\JMETER\LR2JMeter\NGP\Scripts\SV_Db2Queries.csv,,,)} ${__StringFromFile(C:\JMETER\LR2JMeter\NGP\Scripts\SV_Db2Queries.txt,,,)} ${__StringFromFile(C:\JMETER\LR2JMeter\NGP\Scripts\SV_Db2Queries.sql,,,)} but still reads every time only 1 and very 1st sql query – rpagadala Sep 13 '17 at 20:37
  • I have tried using CSVRead() function : My CSV DataSet Config file has configured as :Filename: C:\JMETER\LR2JMeter\NGP\Scripts\SV_Db2Queries1.txt Variable Names : COl1a Delimiter:\t JDBCrequest : ${__CSVRead(SV_Db2Queries1.txt,0)} SV_Db2Queries1.txt file as 2 SQL queries in single row(2 columns) with tab delimiter when i executed Request : goes just [Select Statement] and Responsedata says: [jcc][10234][10927][3.58.82] SQL passed with no tokens. ERRORCODE=-4462, SQLSTATE=null. – rpagadala Sep 14 '17 at 19:16