Download the JDBC Driver
When using JMeter for performance or automated testing, you often need to put pressure on the database directly, or some parameters can only be obtained from the database, you must use JMeter to connect to the database.
1. Download the corresponding driver package
MySQL driver: (Mysql-connector-java-5.1.13-bin.jar may now have a new version), and put it in the JMeter directory under the Lib file, after copying, restart JMeter
Links: http://download.csdn.net/source/3451945
SQL Server driver: Sqljdbc4.jar, the same needs to be placed in the JMeter directory under the Lib file, after replication, restart JMeter
Links: http://download.csdn.net/detail/javaservletsql2008/4859165
Connect MySQL Settings
1, configure the driver, test plan lower right corner, click Browse, select the JDBC driver
2. Add Thread Group
Open JMeter to create a thread group. Right-click Test Plan---> Add--->threads---> Thread Group
3. Configure JDBC
In-thread group, right-click to add a configuration component---> "JDBC Connection Configuration"
4. Configuring the JDBC Connection configuration
1) varible Name: This is the name of the variable, which means it cannot be duplicated.
2) JDBC Url:jdbc:mysql://1920168.0.1:3306/idmdb, where 1920168.0.1:3306: The address and port number of this database; Idmdb, this is the database name of the test. 3) Driver Class:org.gjt.mm.mysql.Driver or com.mysql.jdbc.Driver This is a fixed value of 4) Username: Login name for this database 5) Password: This is the login password for the database
5. Add JDBC Request
Right-click on "Thread Group" and add a "JDBC Request" below, where the variable name name must be the same as the JDBC configuration
6. Implementation results
Connect SQL Server Settings
Unlike the MySQL settings, it is 4, configuring the JDBC Connection configuration other consistent
(1) This value is also used in subsequent JDBC request Variable name:test.
(2) Database URL:jdbc:sqlserver://192.168.1.2:1222; DatabaseName=DBname (requires semicolon-separated, MySQL is/);
(3) JDBC Driver Class:com.microsoft.jdbc.sqlserver.SQLServerDriver (This is also a fixed notation);
(4) Username the user name and password of the password database;
The Configuration reference table for the Database URL (also available in JMeter's help) is shown below:
Configuring the JDBC Connection configuration
JMeter connection mysql and SQL Server configuration