Adding JDBC Requests

Adding JDBC Requests

Adding JDBC Requests- Now that we have defined our users, it is time to define the tasks that they will be performing. In this section, you will specify the JDBC requests to perform.

Begin by selecting the JDBC Users element. Click your right mouse button to get the w Add menu, and then select Add –> Config Element –> JDBC Connection Configuration. Then, select this new element to view its Control Panel (see Figure 7.3).

Set up the following fields (these assume we will be using a MySQL database called ‘cloud’):

  • Variable name (here: myDatabase) bound to pool. This needs to uniquely identify the configuration. It is used by the JDBC Sampler to identify the configuration to be used.
  • Database URL: jdbc:mysql://ipOfTheServer:3306/cloud
  • JDBC Driver class: com.mysql.jdbc.Driver
  • Username: the username of the database
  • Password: password for the username

The other fields on the screen can be left as the defaults.

JMeter creates a database connection pool with the configuration settings as specified in the Control Panel. The pool is referred to in JDBC Requests in the ‘Variable Name’ field. Several different JDBC Configuration elements can be used, but they must have unique names. Every JDBC Request must refer to a JDBC Configuration pool. More than one JDBC Request can refer to the same pool.

jmeter jdbc requests

Selecting the JDBC Users element again. Click your right mouse button to get the Add menu, and then select Add –> Sampler –> JDBC Request . Then, select this new element to view its Control Panel.

jmeter jdbc requests

In our Test Plan, we will make two JDBC requests. The first one is for select all ‘Running’ VM instances, and the second is to select ‘Expunging’ VM instances (obviously you should change these to examples appropriate for your particular database). These are illustrated below.

JMeter sends requests in the order that you add them to the tree.

  • Change the Name to ‘VM Running’.
  • Enter the Pool Name: ‘myDatabase’ (same as in the configuration element)
  • Enter the SQL Query String field.
  • Enter the Parameter values field with ‘Running’ value.
  • Enter the Parameter types with ‘VARCHAR’.

jmeter jdbc requests

Next, add the second JDBC Request and edit the following properties:

  • Change the Name to ‘VM Expunging’.
  • Change the value of Parameter values to ‘Expunging’.

Test Your Software Testing Skills By Taking Our JMeter Practice Tests On This Link

Apply For JMeter Certification

Go back to Tutorial

BUILDING A DATABASE TEST PLAN
BUILDING AN FTP TEST PLAN

Get industry recognized certification – Contact us

keyboard_arrow_up