Putting Theory into Practice with JMeter
Let's move on to practice.
Example 1: Load Test of a Database
Let's start with a simple example (which we will enrich as we go along) that consists of testing a database under MySQL using a SQL query.
In this example, we will use the Employees database available at https://github.com/datacharmer/test_db.
Let's first deal with SQL queries of the SELECT type:
- Let's start by configuring our connection to MySQL using the JDBC Connection Configuration item.
For MySQL, the database URL must be in the form of jdbc:mysql://host:port/dbname and the JDBC driver class must be com.mysql.jdbc.Driver.
In our case, the MySQL database is installed locally on the same machine as JMeter (avoid this absolutely during real tests). Its URL will be jdbc:mysql://localhost:3306/employees:
Note
If not already the case, set the maximum number of connections (Max Number of Connections) to zero so that each thread has its own connection.
Figure 9.7: JDBC connection...