Using Liquibase with DB2 on z/OS

Step 1: Download and Extract Liquibase

  1. Download Liquibase. Visit the download page to get the latest binary.
  2. After downloading the *.zip or *.tar.gz, extract the contents into a folder.

    Note: You may want to add this folder to your system PATH environment so that you can execute Liquibase from any directory.

For this tutorial, we will refer to that directory as LB_HOME, and when executing the Liquibase shell script will use LB_HOME/liquibase or LB_HOME\liquibase.bat as the example command.

Step 2: Install Java

  1. Java is a required dependency. Install Java if it is not already installed.

    Note: You can download and use either the Oracle JDK or OpenJDK. Be sure to configure your PATH and environment variable properly.

  2. Validate that you have a working Java version. On the command line, execute: java -version

Ensure that it runs successfully and displays your installed Java version.

Step 3: Download the DB2JCC Driver and License File

The license JAR file is required when connecting to a mainframe DB2 database, which is not a free JAR file. You must purchase the DB2 Connect product. The license file is contained within the activation package for it. For more information regarding the license file, see Location of the db2jcc_license_cisuz.jar file.

Liquibase comes with a pre-installed driver for DB2 in the liquibase/lib directory. For more information, see Adding and Updating Liquibase Drivers.

Step 4: Set Up the Properties File

While it is possible to pass all required parameters, such as the JDBC driver and database URL on the command line, it is much easier to configure a Liquibase properties file.

Pro Tip: Create multiple Liquibase properties files for your DEV, QA, and PROD environments. You can pass the specific properties file as a Liquibase command line argument.

  1. Create a new directory for your first Liquibase project, and change into that directory. For this example, we named the directory db2_zos
  2. Create a text file named and add the following content:
classpath: <C:/full/path/to/LB_HOME>/lib/db2jcc.jar;><C:/full/path/to/LB_HOME>/lib/db2jcc_license_cisuz.jar>
url: jdbc:db2://<HOST_IP_ADDRESS>:<PORT>/<DBNAME>:retrieveMessagesFromServerOnGetMessage=true;emulateParameterMetaDataForZCalls=1;
username: <DBUSER>
changelog-file: db2zosChangeLog.xml

Note: Be sure to replace the <values> with the actual values for your system.

Ensure that you can execute Liquibase. At the command prompt, run one of the following commands, depending on your platform:


<LB_HOME>/liquibase --help


<LB_HOME>\liquibase.bat --help

You should now see some help output, and you are ready to begin using Liquibase.

Related links