Outline

This post explains how to create JMeter Database Test Plan.

Prerequisites

JMeter & Java JDK download and setup

Database Test Plan Scenario

You will create 5 users that send (1) SQL requests , (2)times  to the database server. That means 5*1*2  – > totally  10 JDBC request will be send.

  • Add user
  • Add JDBC requests
  • Test Results

1- Add user  

First of all I changed my test plan name as “JDBC Test Plan”. Select Test Plan, clicking your right
button to get the Add menu, and then select Add -> ThreadGroup

JDBC_Test_Plan

Now I need MySQL database  , sample table. Now I ll create “testdb” , “worker” as table.

You can download MySql Community edition from here. Later we created sample database and table.

database

Some data insert into worker table

worker_table

Ramp-Up Period, leave the the default value of 0 seconds. This property tells JMeter how long to delay between starting each user. If you set the value to 0, then JMeter will immediately start all of your users.

jdbc_total

2- Add JDBC requests

We need to add JDBC Users element. Select Add -> Config Element -> JDBC Connection Configuration.

jdbc_connection

This example uses the MySQL database driver. Download MySQL Connector jar file from this link http://www.mysql.com/products/connector/ .Extract the zip file and copy .jar file to the JMeter lib directory.

mysql_jar

Now we can configure JDBC connection:

Database URL: jdbc:mysql://localhost:3306/testdb
JDBC Driver class: com.mysql.jdbc.Driver
Username: “your MySQL username”
Password: “your MySQL password”

connection

Select  JDBC Users element Add menu, and then select Add -> Sampler -> JDBC Request

jdbc_request

select_jdbc

3- Test Results

The final element you need to add to your Test Plan is a Listener. This element is responsible for
storing all of the results of your JDBC requests in a file and presenting a visual model of the
data.
Select the JDBC Users element and add a Graph Results listener (Add -> Listener -> View
Results Tree).

result_tree1

result_tree_2

Regards