Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Operation of jmeter Learning Guide mysql Database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Video address: http://edu.51cto.com/lecturer/4626073.html

JMeter can connect to the database through JDBC Connection Configuration and JDBC Request, and carry out addition, deletion, modification and search operations, supporting a variety of common databases. This paper takes the most commonly used MySQL database as an example, and the use of other databases is similar.

Download the driver package

Before using it, you need to download the driver package corresponding to the database.

Take mysql as an example. The driver package I use is mysql-connector-java-5.1.7-bin.jar, which is downloaded and placed in the lib directory of jmeter. Restart jmeter takes effect.

II. JDBC connection configuration

Before sending a JDBC request, you need to connect to the database through the JDBC Connection Configuration component configuration.

As shown in the figure above, there are two points to note:

Variable Name for created pool: the variable name of the connection pool, which must be the same as the connection pool variable name in JDBC Request

Database Connection Configuration: where the url format is jdbc:mysql://ip:port/dbname, and only one sql statement can be executed for a request. To execute multiple sql statements, url should be written as jdbc:mysql://ip:port/dbname?allowMultiQueries=true.

JDBC Driver class selects the driver corresponding to the database. The following is the user name and password for logging in to the database, and other items can be entered according to the default values.

The configuration of different databases is as follows:

III. JDBC Request

Write the sql statement here to add, delete, modify and query, as shown in the following figure:

Note that the variable name in the figure above should be the same as the variable name in JDBC Connection Configuration.

Query Type: different statements correspond to different Query Type

1. A single query statement

Execute a query statement in a request

Database URL:jdbc:mysql://192.168.72.128:3306/dang

Query Type:Select Statement

2. Multiple query statements

Execute multiple query statements in a request

Database URL:jdbc:mysql://192.168.72.128:3306/dang?allowMultiQueries=true

Query Type:Callable Statement

3. Add, delete and modify statements

Insert and delete statements use the same Query Type as update statements, so they are no longer listed separately here.

Query Type:Update Statement of a single sql

Query Type:Callable Statement of multiple sql

4. Parameterized sql statement

Select author from d_book where id=$ {id}

Update d_book set author ='${author} 'where id=$ {id}

5. Placeholder sentence

Select * from d_book where id =? And author =?;? Instead of where conditional value

Parameter values: fill in? The value represented, with multiple values separated by commas

Parameter types: the type of parameter value, no matter what type is written as varchar, several parameters are written, and multiple values are separated by commas

Query Type:Prepared Update Statement or Callable Statement

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report