Using JMeter to test JDBC databases


Despite JMeter is a well-known load testing tool when testing web projects, it seems to be unused when testing SQL performance. So I decided to share how to configure a fairly simple SQL test plan involving only one SQL statement.

Download Apache JMeter and Java, if you don’t have them already.

Get a copy of the oracle driver (ojdbc14.jar) or a JDBC driver of your preferred DB, and throw it into the JMETER_HOME/lib directory

  • Open JMeter and create a test plan as shown in fig1. Based on this plan you can complicate it as you want to load your DB and fit it to your needs. There are two JMeter Listeners (red) called “Aggregate Report” and “Summary Report” that will report us some statistical results like mean, median, throughput among others. I recommend you to use the Statistical Aggregate Report listener. Inside the thread group (blue) are two items of type “JDBC Connection Configuration” and “JDBC Request”. As we will see, is where we define the DB connection properties (user, password, driver, IP, SID), and the statement we want to test.
  • We define in the thread group how many threads want to execute concurrently our statement (red) and how many times will be executed for each thread (blue).
  • You must set a Variable Name (red) to reference this set of connection properties from other JMeter items.
    Typical connection pool properties (blue and green), and connection configuration (pink). Note that the validation query may heavily impact in the tests.
  • The “Variable Name” (red) must be the same you entered in previous step.

Now you’re about to choose the # of concurrent threads (users), pool size, testing time, and extract conclusions in your own environment!

7 Responses to “Using JMeter to test JDBC databases”

  1. […] Defective Electronics cuando ataca la frikinosis: 0′s y 1′s, mayormente. « Using JMeter to test JDBC databases […]

  2. For some Oracle Servers such as 11g or Oracle Exadata Servers the thin client syntax explained may not work. If this is the case you should try copying your tnsnames.ora SID information and use in your script such as:

    jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = XXX )(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XXX )))

  3. image size too much small, text is not readable and example is not clearly understandable.

  4. i done all steps but system is showing 100% errors in summary report, so i am unable to interpret the result values, kindly guide how we configure db with jmeter successfully.

  5. @Rabia
    Add a “view results tree” listener, and run the test again. In the new listener you will be able to find the error, with a complete description.

    BTW: click on the images to show them bigger😛

    HTH

    • ys i did same thing, but always jdbc driver issue and other tyoe of issue, i try to resolve this issue, but still same problem, i perform all steps that is given in examples but always 100% errors showing in summary report.:(

      i clicked on image but image is opening new window having same small size, no bigger image showing.

  6. Check out The Real Secret to Building a Database Test Plan With JMeter for extended information on how to perform database testing using JMeter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: