1.jmeter connect the database, first add the database corresponding connection driver under the test plan
2. After creating the thread group, create the JDBC Connection configuration under the new thread group
3. Configuring JDBC Connection configuration information
Configuration resolution for JDBC
1) ORACLE
URL Link:
Jdbc:oracle:thin:@host:p ort/Service
JDBC Driver Class
Oracle.jdbc.driver.OracleDriver
Oracle Query Database encoding
Select * from where = ' Nls_characterset ';
Validation Query
2) MYSQL
URL Link:
Jdbc:mysql://host:port/service?characterencoding=utf8&allowmultiqueries=true
Jdbc:mysql://host:port/service?useunicode=true&characterencoding=utf8&allowmultiqueries=true
USEunicode=true&characterencoding=utf8 adds the function of specifying the encoding and decoding format of the character.
For example: The MySQL database uses GBK encoding, and the project database uses UTF-8 encoding. If Useunicode=true&characterencoding=utf-8 is added at this time, then there are two aspects of the function:
1. When the data is stored: When the database is holding the project data, the data will be decoded into bytecode using UTF-8 format, and then the decoded bytecode will be re-used GBK encoded into the database.
2. When fetching data: when fetching data from the database, the database will first decode the data in the database into bytecode according to GBK format, then encode the decoded bytecode again in UTF-8 format, and then return the data to the client.
Allowmultiqueries=true Additions are: Allow batch Updates
JDBC Driver Class
Com.mysql.jdbc.Driver
3) MSSQL
JDBC Connection
Jdbc:sqlserver://IP:port;d atabasename=DBname (semicolon separated, MySQL is/); or Jdbc:jtds: SQL Server://localhost:port/"+" library "
Driven
Com.microsoft.sqlserver.jdbc.SQLServerDriver or Net.sourceforge.jtds.jdbc.Driver
4) PostgreSQL
JDBC Connection
Jbdc:postgresql://ip:port/database_name
Driven
Org.postgresql.Driver
3. Create a JDBC Request
Variable name: Names of the corresponding database configurations
Query type: Set the types of queries, allow query, update, all, bring in parameters, etc.
Query: Where to write SQL
Note: "--" or "--"
Note You cannot add ";" after the SQL statement of Oracle during execution.
Jmeter JDBC Connection