JMeter Learning (eight) JDBC test plan-Connect Oracle

Source: Internet
Author: User
Tags mssql mssql download postgresql

I. TEST environment preparation

oracle:10g

JDBC Driver: Classes12.jar

Copy the Oracle installation directory (Oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar) file to the Jmeter/lib directory

jmeter:jmeter-2.11

Two. Design test plan and run

1. Open JMeter, click Test Plan

Click on the "Browse ..." button to add your JDBC driver.

2. Add a thread group, right-click on "Thread Group" and add a "JDBC Connection Configuration" below

To configure the JDBC Connection configuration page.

Pool Timeout: Connection timeout can be modified during this time

3. Right click on "Thread Group" and add a "JDBC request" below.

The parameters that need to be modified include variable Name, to fill in the same content as the JDBC Connection configuration above, so: Oracleconn. This indicates that the JDBC Connection configuration establishes a connection pool named Oracle, after which the other JDBC request shared the connection pool.

NOTE: In SQL statements, you can use parameterization. The values in the INSERT statement can also be parameterized, such as:

Note: It is not possible to add a semicolon after a SQL statement, otherwise it will be reported as syntax error.

4. Add an assertion, right-click the thread group----> Add---> Assert----> Response assertion.

5. Let's add some listeners to the line to view:

Add an assertion result: Right-click the thread group----> Add---> Listener----> Result assertion.

Add a graphical result: Right-click the thread group----> Add---> Listener----> Graphical results.

Add a View results tree: Right-click the thread group----> Add---> Listener----> View the results tree.

Here is a list of all the additions:

6. Thread Group page set number of users, start time, number of cycles, and then click the menu bar "Run"----"Start"

Here's the result:

At this point, jmeter to carry out the stress test to this end, in particular, according to the actual project to carry out.

Note: Assertion results has a serious effect on the throughout of JMeter pressure measurement.

Three. Problems encountered

1. Appearance: Java.sql.SQLException:No suitable driver found for JDBC:ORACLE:THIN:@127.0.0.1:1521:ORCL error resolution

It was because the package was not loaded.

Workaround: Close JMeter, and then copy Class12.jar (search for Classes12.jar This file on your computer) to the Lib directory under the JMeter directory and restart the run.

2. When connecting to MySQL database, it appears: Com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:Unknown character set: ' Utf8mb4 ' ERROR

It seems to be the problem of setting the character, and later in the JDBC connection configuration there will be a database URL plus character encoding (? characterencoding=utf-8)

Jdbc:mysql://127.0.0.1:3306/paydb?characterencoding=utf-8

3. Appearance: Org.apache.avalon.excalibur.datasource.NoAvailableConnectionException:Could not create enough Service your request (Timed out).

Workaround: This occurs because the connection timed out, increasing the pool timeout.

4, the execution prompt: Ora-00911:invalid character.

Workaround: Make sure that the SQL statement you entered in the query in the JDBC request is correct. Note: Do not add semicolons after the SQL statement.

Four. Drive class

Different drive classes corresponding to the jar is different, be sure to note that the following: MSSQL download Sqljdbc4.jar placed under Apache-jmeter-2.6\lib

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 "

Five. Attach the jar package used

Attachment

JMeter Learning (eight) JDBC test plan-Connect Oracle

Related Article

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.