loadrunner可以参数化一些参数,其中一种可以用直接连接数据库取值的方式:选中参数,右键:Replace with Paramater,选择type,点击Properties:
点Data Wizard后可以设置数据库:
下一步后,点Create-->机器数据源-->新建-->系统数据源-->下一步:
1、postgres数据库:
选择你需要的数据源(如:PostgresSQL ODBC Driver(UNICODE))-->下一步-->完成:
这时可以点击Test查看你的数据库配置是否正确
这些做完后,输入sql语句,Finish即可:
2、oralce数据库:
先安装oracle客户端,其间有建立Net服务名
(前面跟postgres数据库一样,然后)选择你安装的oracle:
-->下一步-->完成
-->Data Source Name:the name used to identify the data source to ODBC. For example, "odbc-pc". You must enter a Data Source Name.
Description - a description or comment about the data in the data source. For example, "Hire date, salary history, and current review of all employees." The Description field is optional.
TNS Service Name - the location of the Oracle database from which the ODBC driver will retrieve data. This is the same name entered in configuring network database services using the Oracle Net Manager. For more information, see the Oracle Net Services documentation and Using the Oracle ODBC Driver for the First Time. The TNS Service Name can be selected from a pulldown list of available TNS names. For example, "ODBC-PC". You must enter a TNS Service Name.
User ID - the user name of the account on the server used to access the data. For example, "scott". The User ID field is optional.
-->点击:Test Connection看是否可以连接
-->输入用户名密码-->OK-->OK
-->选择你的数据库源名称,然后确定-->输入用户名密码
在SQL statement框里输入你要查询的sql语句:Finish就OK了。