天天看點

3.9 Jmeter JDBC Request MySQL查詢資料select(Select Statement)

Jmeter Mysql測試之例子

1、加載mysql驅動

mysql-connector-java-5.1.48.jar     (這裡的驅動是對應資料庫mysql5.7)

先把對應mysql版本的jar放入jmeter安裝目錄\lib中    或者在測試計劃中添加該jar包

2.Jmeter測試計劃添加線程組

2.1、線程組下添加JDBC Connection Configuration

      線程組-->配置元件-->JDBC Connection Configuration

Variable Name: mysql

Database URL: jdbc:mysql://10.1.1.248/mytest?useUnicode=yes&characterEncoding=UTF-8

JDBC Driver class: com.mysql.jdbc.Driver

Username: root

Password: XXX

3.9 Jmeter JDBC Request MySQL查詢資料select(Select Statement)

2.2、線程組下添加JDBC Request

線程組-->Sampler-->JDBC Request

Variable Name: name    -->此處的值跟JDBC Connection Configuration的Variable Name一緻。

Query Type:選擇Select Statement   (Insert或update用batchUpdate方法(update statement),select 用select statement)

SQL語句:

select * from USERS;

3.9 Jmeter JDBC Request MySQL查詢資料select(Select Statement)

執行結果:

3.9 Jmeter JDBC Request MySQL查詢資料select(Select Statement)