最近在工作中使用Jmeter工具運行多條sql語句,運行失敗,sql報錯。作者事后整理記錄下來,方便以后查看。
報錯信息如下:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from table;'
1、添加JDBC Connection Configuration並配置
Database URL為MySQL的連接串,如果要執行多條SQL語句,后面還要添加“?allowMultiQueries=true”
JDBC Driver Class是本機的jdbc驅動路徑。Mysql數據庫,默認com.mysql.jdbc.Driver,不同數據庫有不同默認值

2、添加一個JDBC Request並配置
如果要執行多條SQL語句,Quer Type一定要選擇 Callable statement,使用Callable statement時,一次可以包含多個SQL,每條SQL語句用“;”隔開

3、運行jmeter,查看結果(如下圖)

——————————————————————————————————————————-
參考地址:https://blog.csdn.net/qq_36502272/article/details/105457235

