http://www.qatrainingnest.com/blog/wp-content/uploads/2017/11/1-6.jpg

Hi All,

Another useful feature of Jmeter through which one can also perform database performance testing using different sql statements.

Precondition: – Java & Jmeter must be properly installed and configured with required environment variables.

Objective: To know how efficiently SQL queries can perform under some given load

To perform this activity, in Jmeter we need JDBC Request “sampler” and JDBC Connection Configuration “Config Element” and ofcourse Thread Group and controllers.

JDBC configuration:

  1. To configure JDBC with Jmeter, first download the JDBC driver from https://dev.mysql.com/downloads/connector/j/  and then paste the driver JAR file under Jmeter/lib folder.
  2. Add “Thread Group” element under the test plan by right clicking on test plan->Add->Threads (Users) ->Thread Group. Name it  something meaningful.
  3. Now, open Jmeter and add JDBC connection configuration under Thread group as a child.Right click on Thread group->Add->Config Element->JDBC Connection Configuration.
  4. Provide the requested values in connection configuration:
  • Variable Name: (User defined, say v1)
  • Maximum Number of Connections: 0 (if you want connection to be shared then give value more than zero)
  • Pool Timeout 10000
  • Idle cleanup interval(ms): 60000
  • Auto Commit: True
  • Maximum Connection Age(ms): 5000
  • Validation query: Select 1
  • DatabaseURL: jdbc:mysql or jdbc:sqlserver://Server IP:Port/mydb(database name)
  • Server IP and port number info will be available with database team
  • JDBC Driver Class: com.mysql.jdbc.Driver(This parameter vary on the basis of database, here it mention for mysql)
  • User Name: (mysql server access user name)
  • Password: (user’s password)

5.Now to perform a task with database you have to add a sampler-> JDBC request under           thread group:

  • Name: user defined.
  • Variable Name: Same variable name(v1) given at JDBC connection configuration.
  • Query Type: Select your query type from the “Query Type:” drop down list.(It depends whether you trigger a select, update or insert sql command)
  • Avoid using sql statements such as select * from emp[table name] while testing this first time

6.Finally add listeners such as “View Results Tree” to view results for your different JDBC requests:    

Leave a Reply

Your email address will not be published. Required fields are marked *