一、將mysql-connector-java-8.0.12-bin.jar放入Jmeter安裝目錄的bin文件夾中 (注:驅動包的版本一定要與你數據庫的版本匹配,驅動版本低於mysql版本有可能會導致連接失敗報錯)
二、在測試計划面板點擊“瀏覽...”按鈕,將JDBC驅動添加進來。下載和mysql對應的版本,驅動下載地址:https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.12
三 、添加一個“JDBC Connection Configuration”,並配置好各項參數。
四、配置數據庫信息
1)variable name 不能為空;
2)DataBase URL 格式為 jdbc:mysql://服務器ip:端口號/數據庫
3)JDBC Driver Class: com.mysql.jdbc.Driver
四、再添加一個JDBC request
五、執行后,點擊查看結果樹
執行后,若出現Cannot create PoolableConnectionFactory (The server time zone value '???��������??��??' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.)
【解決方案】
修改JDBC Connection Configuration配置中的Database URL,在其末尾加上?serverTimezone=UTC
