Using Liquibase with MaxDB

The purpose of this document is to guide you through the process of creating a new Liquibase project with MaxDB. In this tutorial, you will generate an example project and follow the instructions to apply and learn concepts associated with creating new Liquibase projects with MaxDB.


Before using Liquibase with your database, ensure you have:


To create a Liquibase project with MaxDB on your machine, begin with the following steps:

  1. In your project folder, create a new text file called dbchangelog.sql. Add the following code snippet:
  2. --liquibase formatted sql
  3. Edit the newly created Liquibase properties file to add the following properties:
  4. changelog-file: dbchangelog.sql
    url: jdbc:sapdb://localhost:7200/MaxDB1
    username: user1
    password: password

Tip: To apply a Liquibase Pro key to your project, add the following property to the Liquibase properties file: liquibaseProLicenseKey: <paste code here>

  1. Add a changeset to the changelogchangeset are uniquely identified by author and id attributes. Liquibase attempts to execute each changeset in a transaction that is committed at the end. In the dbchangelog.sql file line 3 add a new “department” create table change set as follows:
  2. --liquibase formatted sql
    --changeset bob:1
  1. Navigate to your project folder in the CLI and run the Liquibase status command to see whether the connection is successful. You can pass arguments in the CLI or keep them in the Liquibase properties file.
  2. liquibase --username=test --password=test --changelog-file=<changelog.xml> status
  3. Run your first update with the update command, which makes changes to your database. You can also run the update-sql command to inspect the SQL before running the update command.
  4. liquibase --changelog-file=<changelog.xml> update-sql
    liquibase --changelog-file=<changelog.xml> update

From SQL Developer Tool User Interface, check your database changes under “user1 schema”. You should see a new “department” table added to the database. For example:

SELECT * FROM "public"."department";

From a database UI tool, ensure that your database contains the table you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.