JMeter JDBC Request connection test MySQL database

Source: Internet
Author: User
Tags mysql version

All JMeter basic component features are not described in this article. JMeter to link the MySQL database, first download the MySQL JDBC driver package ( Note: The driver package version must match the version of your database, the driver version is lower than the MySQL version may cause connection failure error What I'm downloading here is Mysql-connector-java-5.1.7-bin.jar.

1. Once the driver package is ready, the JDBC driver jar package needs to be introduced into the test plan. Operation steps such as:

Click Test Plan-click Browse-Check the MySQL driver Jar Pack--open

2 OK, so the driver is introduced. Next, create a new thread group:

3. Create a new JDBC Connection configuration component under the thread group, detailed configuration such as:

4. By the end of this basic configuration, you can start adding the JDBC Request test database. Create a new JDBC request with detailed steps such as:

Ok, so this is one of the simplest jmeter the script to connect to the MySQL database is basically ready, then add a listener: Look at the results tree, and then run the script, the results are as follows:

5. Of course, in practical applications, many times when we use JMeter test database, we need to use parameterization, for example, to insert some data into the database, but the inserted data are unique, then we need to parameterize the INSERT statement, JMeter The JDBC request parameterization is not different from the parameterization of the other requests: (JMeter's several parameterization methods are not described here), this article gives a simple parametric example, the other way of parameterization is the same.

A.jmeter parameterized with built-in functions: __random (1,100,) means generating a random number of 1-100

The next reference in SQL is:

There are two places that need parameterization, this time you can copy the function helper generated, replace: ${__random (1,100,)}

This is done 20 times to see the effect, set the number of threads to 20, run:

Results

You can see the results in the database:

JMeter JDBC Request connection test MySQL database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.