driver

The --driver global parameter is a case-sensitive string that sets the JDBC 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 based on your database JDBC URL. If you want to use the standard driver for a database that Liquibase supports, you do not need to specify this parameter.

However, you can optionally specify a custom database JDBC driver class name in the --driver parameter. This may be useful if you need to use a non-default driver to access proprietary features from your database vendor.

Tip: You must place your JDBC driver JAR file in your $LIQUIBASE_HOME/lib folder and specify the exact name of the driver for Liquibase to recognize it. You can acquire driver JARs from your database vendor.

For more information on the parameters you need to specify to run Liquibase commands, see Create and Configure a liquibase.properties File.

Syntax

You can set this parameter in the following ways:

Option Syntax
Liquibase properties file (defaults file)
liquibase.driver: <string>
Global flow file argument (example)
stages:
  Default:
    actions:
      - type: liquibase
        command: update
        globalArgs: { driver: "<string>" }
Global CLI parameter
liquibase
 --driver=<string> update
 --changelog-file=example-changelog.xml

JVM system property (JAVA_OPTS Environment Variable)

JAVA_OPTS=-Dliquibase.driver=<string>
Liquibase Environment Variables
LIQUIBASE_DRIVER=<string>

For more information, see Working with Command Parameters.

Troubleshooting

In addition to specifying --driver as a global Liquibase parameter, it's also possible to specify --driver as a parameter for specific Liquibase commands. The command parameter has higher precedence. If you specify it in both places, you may receive this warning message:

WARNING [liquibase.command] Ignoring the global liquibase.driver value in favor of the command value.

If you intentionally specified a custom JDBC driver in multiple places, you don't have to take any action.

However, if you didn't specify your driver in multiple places, check in your liquibase.properties file or other location to ensure that you're using the correct driver for your database.

Related links