Project Setup

Learn how to set up your project to use the Gatling JDBC protocol.

Understand the license and limitations

The Gatling JDBC component is distributed under the Gatling Enterprise Component License.

The Gatling JDBC protocol can be used with both the Community Edition and Enterprise versions of Gatling.

Its usage is unlimited when running tests on Gatling Enterprise. When used with Gatling Community Edition, usage is limited to:

  • 5 users maximum
  • 5 minute duration tests

Limits after which the test will stop. This means that all locally executed tests using the JDBC protocol are limited by these values. When the test stops, Gatling logs which limit it exceeded.

These limits only apply to the JDBC protocol: the JDBC feeder alone isn’t limited.

Get started with the demo project

A demo project is available for each supported JVM language and build tool:

Add the Gatling JDBC dependency

The Gatling JDBC plugin isn’t included with Gatling by default. Add the Gatling JDBC dependency, in addition to the usual Gatling dependencies.

The Gatling JDBC plugin requires Gatling 3.16.1 or later.

For Java or Kotlin:

<dependencies>
  <dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-jdbc-java</artifactId>
    <version>3.16.1.1</version>
    <scope>test</scope>
  </dependency>
</dependencies>

Base Gatling setup for Maven is documented here.

dependencies {
  gatlingImplementation("io.gatling:gatling-jdbc-java:3.16.1.1")
}

Base Gatling setup for Gradle is documented here.

For JavaScript/TypeScript:

npm install @gatling.io/jdbc@3.16.4

For Scala:

<dependencies>
  <dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-jdbc</artifactId>
    <version>3.16.1.1</version>
    <scope>test</scope>
  </dependency>
</dependencies>

Base Gatling setup for Maven is documented here.

dependencies {
  gatlingImplementation("io.gatling:gatling-jdbc:3.16.1.1")
}

Base Gatling setup for Gradle is documented here.

libraryDependencies += "io.gatling" % "gatling-jdbc" % "3.16.1.1" % "test,it"

Base Gatling setup for sbt is documented here.

Add the JDBC driver of your database

Gatling doesn’t ship any JDBC driver. Add the driver of your database as a dependency:

  • For Java, Kotlin, and Scala, in the same scope as the Gatling dependencies.
  • For JavaScript and TypeScript, as a JVM dependency in the gatling section of your package.json:
{
  "gatling": {
    "jvmDependencies": ["org.postgresql:postgresql:42.7.14"]
  }
}

The drivers of the main databases are:

Database Driver dependency
PostgreSQL org.postgresql:postgresql
MySQL com.mysql:mysql-connector-j
MariaDB org.mariadb.jdbc:mariadb-java-client
SQL Server com.microsoft.sqlserver:mssql-jdbc
Oracle Database com.oracle.database.jdbc:ojdbc11

Gatling finds JDBC 4 drivers automatically: there’s no driver class to configure.

Edit this page on GitHub