Creating a Database Test Plan/Load Test On Database Using JMeter

A database application with high response time and poor performance can lead to huge problems. Database Load Testing helps in identifying the performance problems before you deploy your database applications for end-users.

  • It helps you design and simulate usage traffic, which can be used to test your Database application infrastructure for performance, reliability, and scalability.
  • Load Testing of Database applications involves testing the performance and scalability of your Database application with varying user load.
  • Database Load testing involves simulating real-life user load for the target Database application.
  • It helps you determine how your Database application behaves when multiple users hit simultaneously.
  • We forget to test our database performance. The Database can perform slowly, especially when it’s huge. If your website is calling stored procedures or complex queries, then it might be taking a lot of time to process your data.
  • It’s essential to know your database performance and load handling capacity. One of the open-source tools is JMeter, which helps you assess performance.
The Following EXample Demonstrates the Creating Database Test Plan

Before Establishing the connection between JDBC and JMeter, we need to install Oracle Database in your system.

Configuration of JMeter with Oracle JDBC:

  • We can create any Database, either JDBC or MYSQL.
  • Here I am using JDBC to create a Database.
  • So we need to download the Oracle JDBC Driver.
  • The JDBC Driver is available in the form of Jar file, and this jar file we need to add under the JMeter Lib folder.
  • And after that, we need to restart that JMeter.
  • Now go to the browser and type Download Oracle JDBC Driver. And then click on the First Option as below.
    download-oracle-jdbc-driver-jmeter
  • Once you click on the Link, it will navigate to the Official website, as shown below.
    oracle-jdbc-official-website-jmeter
  • You can download any of the JDBC jar files and save the downloaded jar file under JMeter Lib Folder.
  • Once you click on the download button, it will ask you to accept the Oracle License agreement, check-in the I reviewed, and accept the Oracle License Agreement and click on the Download button.
    click-on-download-button-jmeter
  • If you do not have an Oracle account, then create an oracle account with valid credentials.
  • After creating an account, click on download and save the jar file under the lib folder in JMeter as below.
    save-jdbc-jar-file-jmeter
  • If you open the library folder, you will find the OJDBC jar file as below.
    ojdbc-file-under-lib-folder-jmeter
  • Now restart the JMeter in your system.
  • After restarting the JMeter, add the Thread Group to the Test Plan.
    adding-thread-group-to-the-test-plan-jmeter
  • Next, we need to add the JDBC Connection Configuration. Right-click on the Thread Group and select Add-->Config Element-->JDBC Connection configuration.
    add-jdbc-connection-configuration-jmeter
  • The JDBC connection configuration page will look like as below, Which represent the connection details to the Database.
    jdbc-connection-configuration-page-jmeter
  • Some of the Fields are mandatory to fill, so go to the official website of JMeter from there we can give the values for that, Scroll to a configuration element which is as shown below.
  • Under the configuration, Elements goto the JDBC Connection Configuration.
    configuration-elemnets-in-website-in-jmeter
  • Once you click on the JDBC Connection configuration, you will find the below page, which is an older version table of JMeter.
    jdbc-connection-configuration-table-jmeter
  • If you scroll down, you will find the Parameters which are present in the JDBC Connection Configuration.
  • The Parameters which are represented as Yes are the mandatory fields, and you can neglect the remaining areas.
    parameters-in-jdbc-connection-configuration-jmeter
  • The Database URL and JDBC Driver class will change from one Database to another.
  • The Database URL will like as shown below, and the JDBC Driver Class will be as shown below.
    jdbc-driver-class-jmeter
  • You will get the JDBC Driver Class name in the JMeter official website under parameter.
    oracle-jdbc-class-name-jmeter
  • Next, enter the username and password and then save the Test Plan.
  • Next, we need to add a JDBC sampler request, where we need to execute our query.
  • Right-click on the Thread group and the select Add-->Sampler-->JDBC Request.
    jdbc-request-sampler-jmeter
  • The JDBC request will use the JDBC connection configuration, here we have to give the name of the variable we have assigned in the JDBC Connection Configuration.
    enter-name-of-pool-declare-jdbc-jmeter
  • Next, click on the Query Type and select the Select Statement.
    Ad-jdbc-type-jmeter
  • Write the simple query as below.
    write-query-inside-query-tab-jmeter
  • Next, add View Result Tree Listener as below.
  • Now, save and run the Test Plan.
  • When I run the Test Plan, I am getting the following error.
    jdbc-error-jmeter
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions