Database Test Plan with JMeter
Let us see how we can test the database in Jmeter using JDBC Request Sampler.
In this tutorial we will use oracle jdbc driver.
Required jar E.g. “ojdbc6.jar” is placed in <JMETER_Path>/lib.
Prepare a Test Plan as shown below:
Here we have added:
- User Defined Variables – Defined the required parameters for Database Connection
- JDBC Connection Configuration
- Thread Group
- JDBC Request under Thread Group
- BeanShell Sampler – To display the output of the JDBC Request.
- View Results Tree – To View the Results
JDBC Request Sampler is used to send an JDBC Request to database. But before using this we need to setup the required JDBC connection and it is done via JDBC Connection Configuration element.
Under JDBC Connection Configuration we have the below defined values:
We defined the Variable Name as “JDBC_Pool”. The values required for Database Connection are defined in User Defined Variables and are used here.
E.g:
jdbc_url = jdbc:oracle:thin:@DB_Server:port:DB_Instance
jdbc_driver = oracle.jdbc.OracleDriver
jdbc_user = User to connect to DB. E.g. sa
jdbc_pass = Password for the above user
Under JDBC request we have the below values:
The Variable Name should be same as that of Variable Name of JDBC Connection Configuration.
We have different type of Query types as below:
In our example we selected “Select Statement” as Query type.
In the Query section, write the exact SQL query for execution
Under Variable names : Define a variable e.g. sql_var. |
Note: This field can contain a comma-separated list of variable names to hold values returned by Select statements, Prepared Select Statements or CallableStatement.
Under BeanShell Sampler we wrote below line to display the records in the Log Viewer.
Run the Test and view the results have the below output:
If we view the result, it took a significant time ~ 6mins to process the JDBC Request.
abinitio online training
ReplyDeletespark online training
scala online training
azure devops online training
tableau online training
SAP BW on Hana online training
sap sd online training