To test using DB2 set the platform to db2 in src/test/resources/application-test.yaml

Refer to docs / testing if application-test.yaml doesn't exist yet.

    platform: db2 # h2, postgres, mysql, oracle, sqlserver
    ddlMode: dropCreate # none | dropCreate | migrations
    dbName: test

ebean-db2 dependency

We can use the io.ebean:ebean-db2 dependency rather than io.ebean:ebean if we want to only bring in the DB2 specific platform code. Depending on io.ebean:ebean will bring in all platforms.

Docker container

We can programmatically start a docker container version of CockroachDB.

The below uses ebean-test-docker dependency which already comes with ebean-test. If we do not have a dependency on ebean-test then add io.ebean:ebean-test-docker:5.0 as a dependency.

package main;

import io.ebean.docker.commands.Db2Container;

public class Main {

  public static void main(String[] args) {

    Db2Container container = Db2Container.newBuilder("")