1. 下載jdbc 的驅(qū)動(dòng) mysql-connector-java-5.1.41-bin.jar,并將該驅(qū)動(dòng)放到路徑:
創(chuàng)新互聯(lián)建站是一家專(zhuān)注于成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作與策劃設(shè)計(jì),閩侯網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:閩侯等地區(qū)。閩侯做網(wǎng)站價(jià)格咨詢(xún):18980820575
D:\apache-jmeter-3.0\lib\
2. 打開(kāi)Jmeter 工具,添加線程組 ,如圖所示:
3. 在Jmeter工具中,添加JDBC Connection Configuration ,如圖所示:
4.添加JDBC Request ,如圖所示:
5. 添加 查看結(jié)果樹(shù),如圖所示:
6.配置 JDBC Connection Configuration ,如圖所示:
7.配置JDBC Request 處,添加需要使用的sql語(yǔ)句,如圖所示:
8.將已經(jīng)下載的jdbc驅(qū)動(dòng)加載到Jmeter工具中,這樣就使得mysql與Jmeter連接起來(lái)。如圖所示:
選擇 測(cè)試計(jì)劃 —? 進(jìn)入頁(yè)面,點(diǎn)擊 瀏覽按鈕,如圖所示:
9.點(diǎn)擊 綠色的 運(yùn)行按鈕,執(zhí)行結(jié)果,如圖所示:
1,首先寫(xiě)個(gè)方法package util;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;public class DBUtil { static String jdbcURL = "jdbc:mysql://localhost:3306/book";
static String jdbcDriver = "com.mysql.jdbc.Driver";
static String userName = "root";
static String password = "root";
/**
* 獲取數(shù)據(jù)庫(kù)連接對(duì)象
* @return 數(shù)據(jù)庫(kù)連接對(duì)象
* @throws ClassNotFoundException
* @throws SQLException
*/
public static Connection getConnection() throws ClassNotFoundException,
SQLException {
Class.forName(jdbcDriver);
return DriverManager.getConnection(jdbcURL, userName, password);
}
} 2。項(xiàng)目名==右鍵==build path==add external archivers.... 選擇你mysql驅(qū)動(dòng) 添加進(jìn)去就ok了
1,首先寫(xiě)個(gè)方法package util;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;public class DBUtil { static String jdbcURL = "jdbc:mysql://localhost:3306/book";
static String jdbcDriver = "com.mysql.jdbc.Driver";
static String userName = "root";
static String password = "root";
/**
* 獲取數(shù)據(jù)庫(kù)連接對(duì)象
* @return 數(shù)據(jù)庫(kù)連接對(duì)象
* @throws ClassNotFoundException
* @throws SQLException
*/
public static Connection getConnection() throws ClassNotFoundException,
SQLException {
Class.forName(jdbcDriver);
return DriverManager.getConnection(jdbcURL, userName, password);
}
} 2。項(xiàng)目名==右鍵==build path==add external archivers.... 選擇你mysql驅(qū)動(dòng) 添加進(jìn)去就ok了