脚本----LoadRunner连接Oracle数据库
2018-04-11 11:28
232 查看
(2017-02-17 09:40:19)
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
转载▼
LoadRunner中提供了针对数据库操作的功能函数,注意一下函数只能用于Web Services协议,具体用法如下, 1、LR新建一Web Services协议脚本2、计算机本地安装oracle客户端(非简装版,不管电脑是32位还是64位均建议安装oracle11g-32位的),下载地址http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.html3、LoadRunner脚本中使用lr_db_connect函数与数据库建议连接:其中SID、USERNAME、PWD分别替换为自己欲连接数据库的SID、用户名和密码。lr_db_connect("StepName=Connect", "ConnectionString=Provider=OraOLEDB.Oracle.1; Data Source=SID; Persist Security Info=True; User ID=USERNAME;Password=PWD", "ConnectionName=db1", "ConnectionType=OLEDB", LAST ); 4、执行sql语句,其中SQLStatement后面替换为自己需要执行的sql语句。lr_db_executeSQLStatement("StepName=PerformQuery", "ConnectionName=db1", "SQLStatement=select SERIALNO from FLOW_TASK where objectno = '0000001'", "DatasetName=MyDataset", LAST ); 5、从sql语句的执行的数据集中检索值:其中SERIALNO为步骤4中检索的字段名,SerialNo_1可以在脚本中当参数使用。lr_db_getvalue("StepName=GetValue", "DatasetName=MyDataset", "Column=SERIALNO", "Row=next", "OutParam=SerialNo_1", LAST ); 6、得到的参数可以打印出来。 lr_output_message("The value is: %s", lr_eval_string("{SerialNo_1}") ); 7、断开数据库连接。lr_db_disconnect("StepName=Disconnect",
"ConnectionName=db1",
LAST );
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
转载▼
标签: itloadrunneroracleld_db_connect | 分类: 性能测试工具_LoadRunner |
"ConnectionName=db1",
LAST );
相关文章推荐
- 脚本——loadrunner的连接oracle数据库参数化-具体步骤
- 脚本——loadrunner连接oracle数据库查询数据
- linux的shell脚本中连接oracle数据库进行操作的方法
- LoadRunner长连接性能测试脚本
- Perl连接Oracle数据库的一些操作脚本【转】
- shell脚本连接oracle数据库并将查询出的数据写入文件
- LoadRunner录制脚本,报连接不到服务器的提示信息 :Request Connection: Remote Serve
- loadrunner连接数据库脚本
- linux下 PHP脚本连接oracle数据库
- LOADRUNNER连接ORACLE数据库的方法
- 使用Loadrunner连接oracle数据库
- Loadrunner 连接SQL数据库,获取验证码脚本
- Linux shell脚本中字符串连接的方法
- 安装unxiodbc软件,连接oracle数据库
- LoadRunner专题系列——LoadRunner脚本中的参数化
- 安卓开机检测 显示器 是否连接 hdmi脚本
- Loadrunner脚本回放无法准确定位欲删除元素
- 64位程序,利用ADO连接Oracle数据库
- WIN7_X64连接远程Oracle数据库