Using Liquibase with VoltDB

Image of Julius Krah Written by: Pavan Mulani

The purpose of this document is to guide you through the process of creating a new Liquibase project for VoltDB. In this tutorial, you will learn how to install the required database drivers and configure the file to establish a database connection to VoltDB.

Support for VoltDB is provided via a Liquibase extension. The extension provides basic database operations including:

  • DML statements
  • DDL statements



To configure a Liquibase project for VoltDB, perform the following steps:

  1. Install the JDBC driver.

You can place the JDBC driver in the liquibase/lib install directory so that it will automatically be located when executing Liquibase commands. Also, you can use another directory and add the location to the classpath in the file.

  1. Install the Liquibase extension.

Copy the extension jar file into the $LIQUIBASE_HOME/lib directory.

  1. Create a project folder.

The project folder will be used to store the Liquibase configuration files and changelogs.

  1. Create the file in the project folder.

Note: If you are not familiar with configuring the file, see Creating and configuring a file tutorial.

The file should contain the following properties:

changeLogFile: dbchangelog.xml 
url: jdbc:voltdb:// 
username: voltdb 
password: voltdb 
driver: org.voltdb.jdbc.Driver 
classpath: ../../Liquibase_Drivers/jdbcdriver.jar

Note: Liquibase supports only the following special characters: ~ # $ % * ( ) - _ + [ ] { } . ?. Unsupported special characters are as follows: @ & / : < > " ' ` | ^ ! = , \ <spaces>.

Use the following format for the url property:

  • If you placed your jdbc driver file in the liquibase/lib install directory, there is no need to specify the classpath property in the file. Otherwise, put the path to your drivers as it is shown in the preceding example.
  • If you already have a Liquibase Pro key and want to apply it to your project, add the following property to your file:
liquibaseProLicenseKey: <paste license key>
  1. Create a dbchangelog.xml file in the project folder.

Add a changeset to the changelog. The changesets are uniquely identified by author and id. Liquibase attempts to execute each changeset in a transaction that is committed at the end. In the dbchangelog.xml file, add a new department create table changeset as follows:

<?xml version="1.0" encoding="UTF-8"?>
<createTable  tableName="person">
      <column  name="id"  type="int"  autoIncrement="true">
            <constraints  primaryKey="true"  nullable="false"/>
      <column  name="firstname"  type="varchar(50)"/>
      <column  name="lastname"  type="varchar(50)">
            <constraints  nullable="false"/>

<changeSet author="authorname" id="insert-example"> 
      <insert tableName="person">
      <column name="id" value="1"/>
      <column name="firstname" value="Bob"/>
      <column  name="lastname"  value="Builder" />
  1. Generate and execute SQL

Open the command prompt, navigate to the project directory, and then run the following command to get the SQL output of the changelogs:

liquibase updateSQL

To execute the changeset in your schema, run the following:

liquibase update
  1. Verify that the tables have been created

From a database UI Tool, check your database changes. You will see a new person and table added to the database. For example:


Also, you will see two more tables:

DATABASECHANGELOG table. This table keeps a record of all the changesets that were deployed. This way, when you deploy again, the changesets in the changelog will be compared with the DATABASECHANGELOG tracking table, and only the new changesets that were not found in the DATABASECHANGELOG will be deployed. You will see that a new row was created in that table with the changeset information you have just deployed. For example:

DATABASECHANGELOGLOCK table. This table is used internally by Liquibase to manage access to the changelog table during deployment.


You have successfully configured your project and can begin creating changesets to migrate changes to your database. For more information on how to create changesets, see changeset.

See also