This section describes how to use JMeter for connection testing of SQL Server, using test libraries and test tables as well as the previous section, "Performance test Tool operations Database (vii)-loadrunner and SQL Server", to make it easy for you to learn in comparison.
1. Install the JDBC driver first
Driver download link address: http://pan.baidu.com/s/1bpDpjSr Password: v6tn
After downloading the decompression, place the Sqljdbc4.jar in the JMeter installation directory/lib, restart JMeter after replication, or refer to the jar package path directly in the test plan as follows:
2. Add and configure the JDBC Connection configuration after adding the thread group
To configure the connection as described above, the parameters that need to be configured are:
(1) This value is also used in subsequent JDBC request Variable Name:sqlconn (connection pool name);
(2) Database Url:jdbc:sqlserver://172.16.1.215:1433;databasename=layim (the default port number is 1433, everyone according to their own database environment configuration);
(3) JDBC Driver Class:com.microsoft.sqlserver.jdbc.SQLServerDriver (many of the online is wrong, different versions of the database requirements match);
You need to determine your SQL Server version, which is 2003 or 2008, because two versions of the drive configuration are not the same, 2008 is Com.microsoft.sqlserver.jdbc.SQLServerDriver, the previous version is Com.microsoft.jdbc.sqlserver.SQLServerDriver.
(4) Username the user name and password of the password database;
3. Add Query JDBC Request
4. Add Insert data jdbc Request
In this case, the variable parameter is inserted as a placeholder, so the query type is required to be prepared Update Statement, and the type criteria can be found in the Performance test tool operations Database (vi)-jmeter and PostgreSQL The difference between the statement,preparedstatement,callablestatement of JDBC
5. Update and delete are not examples, as with insert.
In the last summary, the URL connection to the JMeter operation database and the driver class are listed to
Database |
Driver class |
Database URL |
Sample URL |
Oracle |
Oracle.jdbc.driver.OracleDriver |
Jdbc:oracle:thin: @host:p Ort:service |
Jdbc:oracle:thin:@172.16.1.70:1521:orcl |
Mysql |
Com.mysql.jdbc.Driver |
Jdbc:mysql://host:port/{dbname} |
Jdbc:mysql://172.16.1.67:3306/testdb |
Mongodb |
Using the templates in the Mongodb.jmx |
|
|
PostgreSQL |
Org.postgresql.Driver |
Jbdc:postgresql://ip:port/{dbname} |
Jbdc:postgresql://172.16.1.67:5432/testdb |
MS SQL |
Com.microsoft.sqlserver.jdbc.SQLServerDriver |
Jdbc:sqlserver://host:port;databasename=dbname |
Jdbc:sqlserver://172.16.1.215:1433;databasename=layim |
JMeter with SQL Server