JMeter different database connections

Source: Internet
Author: User
Tags postgresql

JMeter performance test use of JDBC Request (querying database for database data)

JDBC Request

This sampler can send a JDBC request (SQL statement) to the database and get the returned database data to operate. It often needs to be used with the JDBC Connection configuration master (configuration database connection related properties, such as connection name, password, etc.).

a . preparatory work

1 , using SQL Server database for testing , the database user name is root (your own user name), username password is ********* (your own password)

2 , there are tables in the database : Sys_user, the data structure of the table is as follows:

3. The data in the table are:

Two Add a different driver

Using different databases, we need to introduce different jar packages.

Method 1: Copy the jar package directly to the JMeter Lib directory

    • MySQL database: No need to introduce additional database driver jar packages.
    • SQL Server database: Download Sqljdbc4.jar into the JMeter root directory under the Lib directory
    • Oracle database: Place the \product\10.2.0\db_1\jdbc\lib\ojdbc14.jar under the installation directory of the Oracle data under the JMeter root directory in the Lib directory

Mode 2: If we do not use the way to copy the jar to the JMeter Lib directory, we can also use JMeter's test plan to introduce the corresponding jar package, such as the following jar package that introduces SQL Server data

three. Configuring the JDBC Connection Configuration

Important Parameter Description:

    • VariableName: Database connection pool names, we can have multiple JDBC connection configuration, each can have a different name, in the JDBC The request can be used by selecting the appropriate connection pool for this name.
    • Database URL: DB url,jdbc:mysql://host IP or machine name: MySQL listener port number/database name, such as: Jdbc:mysql://localhost:3306/test
    • jdbc Driver class: JDBC Driver
    • username: User name of database login
    • passwrod: password for database login
      • Different database specific 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 "

SQL Server fills in the following general steps:

Four . Configuration JDBC Request

Variable Name: Database connection pool is consistent with JDBC Connection Configuration

Query:sql script, fill in the SQL statement does not add ";"

Execution Result Tree The results are as follows :

JMeter different database connections

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.