测试准备
1、Jmeter版本:3.1,JDK:1.7;
2、postgresql驱动包postgresql-42.2.5.jre7.jar,将该jar包置于..\apache-jmeter-3.1\lib\文件下,如果不成功,需要在测试计划中添加引用到Library;
3、postgresql的驱动包可以到官网下载:https://jdbc.postgresql.org/download.html
jmeter配置
在线程组内添加数据连接配置 (JDBC Connection Configuration)
其中Variable Name Bound to Pool可以随意取一个名称(后面的连接请求都关联这个连接池名称)
postgres数据库配置的URL和Driver Class需要按照格式填写,如下:
Database URL格式:jbdc:postgresql://ip:port/database_name
JDBC Driver class格式:org.postgresql.Driver
添加Select的JDBC请求
Variable Name bound to pool中的Variable Name与JDBC Connection Configuration中Variable Name bound to pool中的Variable Name保持一致;