Simple explanation: The JDBC request is to use JMeter to connect to the database, execute the SQL statement, and return the corresponding response result
Steps:
1, the introduction of the use of the database drive jar package, using a different database, we need to introduce a different jar package. This article uses the MySQL, introduced Mysql-connector-java-3.0.17-ga-bin.jar
Introduction method: Directly copy the jar package to JMeter's Lib\ext directory
2. Create a test plan, add a database configuration component, configure database connection information,
JDBC Driver class, different database filling methods, you can refer to the following table
|
Datebase |
Driver class |
Database URL |
|
Mysql |
Com.mysql.jdbc.Driver |
Jdbc:mysql://host:port/{dbname} |
|
PostgreSQL |
Org.postgresql.Driver |
Jdbc:postgresql:{dbname} |
|
Oracle |
Oracle.jdbc.driver.OracleDriver |
Jdbc:oracle:thin:user/[email Protected]//host:port/service |
|
Ingres (2006) |
Ingres.jdbc.IngresDriver |
Jdbc:ingres://host:port/db[;attr=value] |
|
MSSQL |
Com.microsoft.sqlserver.jdbc.SQLServerDriver
Or
Net.sourceforge.jtds.jdbc.Driver |
Jdbc:sqlserver://ip:1433;databasename=dbname
Or
jdbc:jtds:sqlserver://localhost:1433/"+" library " |
3. Then add the JDBC request, write the SQL statement to query
Execution results
Extensions: Query parameters can use placeholders and parameterization
JMeter JDBC Request for common script development