database-class

The database-class global parameter is a string that specifies which implementation of our Database class to use. By default, Liquibase automatically determines the correct class based on your database connection.

Uses

When Liquibase connects to a database, it selects an implementation of our Database class that represents the type of database you have connected to. We use that selection to know what kind of database you have and what functionality it supports.

You should generally rely on Liquibase’s auto-detection logic to implement the Database class. However, you can override the selected class with the database-class parameter.

Setting the database-class parameter

You can set database-class in four ways:

  • In the Liquibase properties file
  • As a global parameter in the CLI
  • As a JVM system property
  • As an environment variable (Liquibase Pro)

Liquibase properties file parameter

In Liquibase 4.1+, add the following to Liquibase properties file:

liquibase.databaseClass: <string>

CLI global parameter

In your command line, use a global parameter with a single Liquibase command:

liquibase --database-class=<string> update --changelog-file=dbchangelog.xml

Java system property

In your command line, use the JAVA_OPTS Environment Variable to set a JVM system property:

Mac/Linux syntax:

JAVA_OPTS=-Dliquibase.databaseClass=<string>

Windows syntax:

set JAVA_OPTS=-Dliquibase.databaseClass=<string>

Note: To use a Liquibase command alongside JAVA_OPTS, add && liquibase <command> to the end of your input.

Environment variable (Liquibase Pro)

In Liquibase Pro, set an environment variable:

Mac/Linux syntax:

LIQUIBASE_DATABASE_CLASS=<string>

Windows syntax:

set LIQUIBASE_DATABASE_CLASS=<string>

Note: These environment variable commands only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.