Using Liquibase with Sybase Anywhere

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


Note: Place your jar file in the Liquibase/lib install directory.


To create a Liquibase project with Sybase Anywhere, perform the following steps:

  1. Create a new project folder and name it LiquibaseSybaseAnywhere.
  2. In your LiquibaseSybaseAnywhere folder, create a new text file and name it
  3. Edit the file to add the following properties:
changeLogFile: dbchangelog.xml
url: jdbc:jtds:sybase://localhost:5002/MYDATABASE
username: user1
password: password
driver: net.sourceforge.jtds.jdbc.Driver
classpath: ../../Liquibase/lib/jtds-1.3.1.jar

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

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. In your LiquibaseSybaseAnywhere folder, create a new text file and name it dbchangelog.xml. The changelog files contain a sequence of changesets, each of which makes small changes to the structure of your database.

Note: Instead of creating an empty changelog file, you can use an existing database to generate a changelog. In this tutorial, you will manually add a single change. To add this change, open the XML file and update the changelog file with the following code snippet:

<?xml version="1.0" encoding="UTF-8"?>
  1. 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"?>

           <changeSet id="1" author="bob">
             <createTable tableName="department">
                <column name="id" type="int">
                     <constraints primaryKey="true" nullable="false"/>
                <column name="name" type="varchar(50)">
                      <constraints nullable="false"/>
                <column name="active" type="boolean" defaultValueBoolean="true"/>

Note: The preceding changeset is XML format. The corresponding SQL statement looks like the following:

--liquibase formatted sql

--changeset bob:1
  1. Open the command prompt, navigate to the LiquibaseSybaseAnywhere directory, and then run the following command:
liquibase update
  1. From a database UI Tool, check your database changes. You will see a new department; table added to the database. For example:
SELECT * FROM "dbo"."department";
ID Name Active




Also, you will see two more tables:

DATABASECHANGELOG tracking table. This table keeps a record of all the changesets that were deployed. This way, next time 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 we have just deployed. For example:

ID Author Filename Dateexecuted Orderexecuted Exectype MDSum








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