|
#include
{
push Timeout_scale = 200; /* Set timeouts to 200% of maximum response time */
push Think_def = "LR";
Min_tmout = 120000; /* Set minimum Timeout_val to 2 minutes */
push Timeout_val = Min_tmout;
ser=sqlconnect("server","sa","8888","192.168.1.12","sqlserver");
set Server_connection = ser;
push Think_avg = 0;
sqlexec ["sql_1000"] "select * from test_table";
sqldisconnect (ser);
}
sqlconnect("server","sa","8888","192.168.1.12","sqlserver"):数据库连接
参数:server:标签,由于Testmanager报告输出
sa:用户名
8888:密码
192.168.1.12:数据库IP地址
sqlserver:API库,连接SQL Server为sqlserver
sqlexec:执行SQL语句
sqldisconnect:断开数据库连接
VU脚本加入数据池(DATAPOOL),向测试数据库中装配测试数据时效率很高,推荐使用。如何加入数据池看帖子“数据池(DATAPOOL)专题”。 |
|