driver parameter

The driver global parameter is a string that sets the driver for the target database you're using with Liquibase.

Uses

Each database has its own driver, such as oracle.jdbc.OracleDriver for an Oracle database. Liquibase automatically specifies the driver for most supported databases. However, you can also specify a custom database driver in the driver parameter.

For more information on the parameters you need to specify to run Liquibase commands, see Creating and configuring a liquibase.properties file.

Setting the driver parameter

You can set driver in four ways:

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

Java system property

You can set driver as a Java system property by using the JAVA_OPTS Environment Variable in your command line. The syntax on Mac/Linux is as follows:

JAVA_OPTS=-Dliquibase.driver=YOUR_DRIVER && liquibase diff --changelog-file=dbchangelog.xml

The syntax on Windows requires the set command:

set JAVA_OPTS=-Dliquibase.driver=YOUR_DRIVER && liquibase diff --changelog-file=dbchangelog.xml

liquibase.properties parameter

You can set driver by adding the following to your liquibase.properties file:

liquibase.driver: YOUR_DRIVER

CLI global parameter

You can use driver as a global parameter in your command line with a single Liquibase command, such as diff:

liquibase --driver=YOUR_DRIVER diff --changelog-file=dbchangelog.xml

Environment variable (Liquibase Pro)

If you use Liquibase Pro, you can set driver as an environment variable. The syntax on Mac/Linux is as follows:

LIQUIBASE_DRIVER=YOUR_DRIVER

The syntax on Windows requires the set command:

set LIQUIBASE_DRIVER=YOUR_DRIVER

Note: The commands shown above 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.

Related links