Jmeter从文件运行SQL脚本 [英] Jmeter Run SQL script from file
问题描述
我正在尝试在Jmeter SetUp线程中运行几个SQL脚本.是否可以通过Jmeter从.SQL文件运行SQL代码,以便我可以在执行其他线程之前初始化数据库.我只是不想破坏我的代码,并使用JDBC连接和JDBC请求在Jmeter中复制/粘贴代码.谢谢!
I am trying to run a couple SQL scripts in a Jmeter SetUp thread. Is it possible to run the SQL code from a .SQL file through Jmeter so I can initialize a database before my other threads get executed. I just don't want to break my code up and copy/paste code inside Jmeter using JDBC connection and JDBC request. Thanks!
推荐答案
__FileToString() 函数似乎是您要找的东西,您可以将其放在您的 JDBC Request 采样器,然后在其中指定.sql文件的路径,
__FileToString() function seems to be something you're looking for, you can put it inside your JDBC Request sampler and specify path to your .sql file there like:
请参阅 Apache JMeter函数-简介进行熟悉JMeter函数概念
See Apache JMeter Functions - An Introduction to get familiarized with the JMeter Functions concept
这篇关于Jmeter从文件运行SQL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!