Oracle Database Testing

Apache JMeter


About - Apache Jmeter
Downloading Jmeter
JMeter Components
Preparing Test Plan
• Thread Group Control
• JDBC Connection Configuration control
• JDBC Request Control
• View Result Tree Control
• User Parameter Control
• CSV Data Set Config
Stored Procedure Execution
Log File
Measuring Response Time & Throughput

About Apache JMeter

Apache JMeter is open source software, a 100% pure Java
desktop application designed to load test functional behavior and
measure performance. It was originally designed for testing Web
Applications but has since expanded to other test functions.
Apache JMeter may be used to test performance both on static and
dynamic resources (files, Servlets, Perl scripts, Java Objects, Data
Bases and Queries, FTP Servers and more). It can be used to
simulate a heavy load on a server, network or object to test its
strength or to analyze overall performance under different load
types. You can use it to make a graphical analysis of performance
or to test your server/script/object behavior under heavy
concurrent load.


Can load and performance test many different server types:
• Database via JDBC
• Mail - POP3(S) and IMAP(S)
Complete portability and 100% Java purity.
Full multithreading framework allows concurrent sampling by many threads and
simultaneous sampling of different functions by separate thread groups.
Careful GUI design allows faster operation and more precise timings.
Caching and offline analysis/replaying of test results.
Highly Extensible:
• Pluggable Samplers allow unlimited testing capabilities.
• Several load statistics may be chosen with pluggable timers .
• Data analysis and visualization plugins allow great extendibility as well as
• Functions can be used to provide dynamic input to a test or provide data
• Scriptable Samplers (BeanShell is fully supported; and there is a sampler which
supports BSF-compatible languages)


Allows to perform load testing of sql queries, stored procedure,
triggers and functions at different volume sizes.
Helps in data validation of sql queries, stored procedures.
Helps in graphical monitoring and analysis of response time &
throughput of the database objects under heavy concurrent load.
Allows saving the results obtained in a file for analysis.

Download & Running JMeter

Download the JMeter version 2.3.4 from the following url:
Run the jmeter.bat file from the JMeter installation directory.

JMeter Components



The requests to the servers are being sent by these elements for the request
types SOAP, JDBC, "Java", HTTP/HTTPS, FTP.


The results of the run can be saved by these elements in the single request,
tabular forms etc by saving the results in a named file.


To make the test more realistic we use Timers element to insert delays
between the requests.
Logic controllers are used if you have defined the request to be executed on
some logic like if-then-else and loop structures in Java etc.

Configuration Common information about the requests is added to work with samplers
using this element.

This element is used to check whether you are getting the responses within
a given amount of time containing the expected data or not.

Preparing Test Plan
Thread Group Control

Thread Group allows to run script with nth no. of users with defined
ramp-up period and also the scheduling of execution.
Right click on the Test Plan and add the Thread Group control.

Thread Properties:
Allows to set the no. of
users, ramp-up time
and iterations

JDBC Connection Configuration control

Used to configure the database i.e. Oracle, MS SQL Server etc.
Add JDBC Connection Configuration control to the Test Plan.
Database Connection Configuration
• Database URL: jdbc:oracle:thin:@localhost:IP:service (e.g. IP: 1521,
Service: oracle)
• JDBC Driver Class: oracle.jdbc.driver.OracleDriver
• Username: Username of the database (e.g. Username: scott)
• Password: Password of the user (e.g. Password: tiger)
• Add the following Jars in JMeter Installation directory (D:\jakartajmeter-2.3.1\lib)

classes12.jar & ojdbc14.jar

• These files are available in Oracle installation directory

JDBC Request Control

JDBC Request control allows to run a SQL query, procedure etc.
Add the JDBC Request control below the Thread Group.

Query: type SQL Queries
and stored procedure

View Result Tree control

View Result Tree control is used to view the result of the query
Sampler Result: shows
the load time, response
Add View Result Tree control to the Test Plan.
code etc..

Green: Request
Red: Request failed

View Result Tree control

shows the

View Result Tree control

data: shows the


User Parameters Control


User Parameters control allows the script to be run with multiple
values like username, password, department no. etc. We can add
variables and also provide values of the variable to multiple users.
Add the User Parameters control to the Thread Group.

Name: variable
User_1: value of
User_2: value of

User Parameters Control

Pass the variable to the query or procedure.
${variable_name} (e.g. ${Dept_No})
$: used to fetch the variable

Sample Query:
update dept set loc=‘India' where deptno=${Dept_No}

CSV Data Set Config Control

Allows parameterization using a file.
Add the CSV Data Set Config control to the Thread Group.

Execution of Stored Procedure

Add the JDBC Request control to the Thread Group.
• Procedure must exist in database.
Type the following command in SQL Query text box of the JDBC Request
begin{…};end; block: PL/SQL

statement should be enclosed within
{call update_DEPT_PKG.update_DEPT(10)};

This example takes the
department no as input
and doesn’t return
begin…end block.

Stored Procedure must be written inside the
Call keyword is used to call the stored procedure.

View Result Tree control

Response Message:
Ok – if request passed
else error message will
be returned

Viewing SProc returning value

Choose Callable Statement from Query Type combo box.
Type the following command in SQL Query parameter of the JDBC
Request control
declare: used to
declare variable(s)

This example takes the
department no as input and
return department name
deptname varchar2(20);
which we store in deptname
{call update_DEPT_PKG1.update_DEPT1(${Dept_No},?)};

Write ${deptname} in Parameter values text field.
Write OUT VARCHAR in Parameter types text field.
${Dept_No}: IN
variable – passing
department no. to the

?: store the OUT variable
in variable $
{deptname} to verify
the output

Viewing SProc returning value

Callable Statement:
choose in case of PL/SQL

Viewing SProc returning value

output returned by

Log file

Create a file_name.jtl file to save log and provide the .jtl file path in
File Name text box in any of the Listener (View Results Tree).
Click on the configure button and choose the following checkbox:
• Save Response Data (XML)

Returns the output data

• Save Sampler Data (XML)

Returns the executed sql query

• Save Response message (XML)

Returns the error message (if returned)

Measure Response Time & Throughput
Statistical Aggregate Report


Sign up to vote on this title
UsefulNot useful