In this article we are going to see how to create a test plan in JMeter for Database testing.
Step1: Goto your JMeter, and create a new testplan, add "JDBC Connection Configuration" from Add -> Config Element.
Here we need to provide the details of database.
Database URL: //URL to connect to DB
JDBC driver class:
Username: root //DB Username
Password: admin //Password to login to DB
Maximum number of connections: 10
Variable Name: test
Step2: We need to add mysql-connector-java jar in JMeter lib folder, since we are testing MySQL DB. You can either download this jar from https://dev.mysql.com/downloads/connector/j/
or, if you already have MySQL installation on local system, you can get "mysql-connector-java-8.0.17.jar" from "C:\Program Files (x86)\MySQL\Connector J 8.0" folder.
Once copied, restart JMeter.
Step3: Add JDBC request, Add -> Sampler -> JDBC Request.
add, Variable Name: test // This is a way to tell JMeter that this JDBC request will use configuration named "test" in "JDBC Connection Configuration".
And in SQL Statement placeholder write our query:
Select * from TMS
Step4: To see the results, add view results in tree and table listeners.
Step5: Run and validate the results.
This is how we can do performance test on Database.
Top comments (0)