JDBC Feeder

Learn how to load the records of a feeder from your database with a SQL query.

Understand the JDBC feeder

The JDBC feeder runs a SQL query when the simulation starts, and loads the rows it returns as feeder records: each row is a record, whose keys are the column labels. It’s part of the Gatling JDBC plugin: add its dependency and the JDBC driver of your database, as described in project setup. The usage limits of the Community Edition don’t apply to the feeder.

Create a JDBC feeder

Add the following imports:

       
import static io.gatling.javaapi.jdbc.JdbcDsl.*;
// Support coming soon
import io.gatling.javaapi.jdbc.JdbcDsl.*
import io.gatling.jdbc.Predef._

Then create the feeder with the JDBC URL of the database, the credentials, and the SQL query:

       
jdbcFeeder("jdbc:postgresql://localhost:5432/shop", "username", "password", "SELECT * FROM users");
// Support coming soon
jdbcFeeder("jdbc:postgresql://localhost:5432/shop", "username", "password", "SELECT * FROM users")
jdbcFeeder("jdbc:postgresql://localhost:5432/shop", "username", "password", "SELECT * FROM users")

Like file-based feeders, it loads all its records in memory, and supports the same strategies, such as circular or random.

Edit this page on GitHub