- To establish a JDBC Link: Create a jdbc Connection Configuration.
- Add--Configure components--JDBC Connection configuration:
- Configure the JDBC Connection configuration:
Description
1) Variable Name: The name of the database connection pool, which is important, required, andis used in theJDBC Request .
2) Maxnumber of Connections: Max connections
3) Pool timeout: Maximum time for database connection pool timeout
4) Idle Cleanup Interval (ms): How long interval, clear idle (idle connection)
5) keep-alive: Pool activity exists
6) Max Connection Age (MS): Time of the most active connection pool
7) Validationquery: Dynamic queries
8) JDBC Driver class:jdbc driver, because I am using a MySQL database, so this is configured as Com.mysql.jdbc.Driver. If other, refer to other materials.
2. Test database: JDBC request test
- Add--SAMPLER--JDBA Request:
- Configure JDBA Request:
Description
1) Variable name: Same as Variable name in the JDBC Connection configuration above, this indicates that the JDBC Connection configuration establishes a connection pool named Oracle. This connection pool is then shared by other JDBC Request.
2) SQL Query:sql statement, cannot add ";".
3) Parameter values: parameter values, which can be used in SQL query statements with the "?" Instead , make a query.
Such as
4) Parameter types: Parameter type, refer to: Javadoc for Java.sql.Types
5) Variable names: Save the variable name of the SQL statement that returns the result (similar to the row, column, multi-column, multi-parameter) of the returned result table, you can create a debug sampler run to see the data.
As above with a A, a: query results are 1 columns of 3 rows of data,
6) Result variable name: Create an object variable, save all returned results, can create debug sampler run look at the data
As above with Titlenm_result:
7) Query timeout: Query time-out
8) Handle result set: Defines how to handle the results returned by the callable statements statement
3. Execution error Java.sql.SQLException:No suitable driver found for JDBC:
- check that the database URL is correct.
- Check that the JDBC Driver class input is correct.
- Check to see if there are any corresponding jar packages under the Apache-jmeter-2.13\lib\ext path, for example, I use mysql-connector-java-5.1.38-bin.jar like this.
JMeter Testing the database (MySQL database)