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.


Before using Liquibase with your database, ensure you have:

  • Downloaded the JDBC JAR driver file. Place your JAR file in the liquibase/lib install directory or in any other known directory so you can locate it easily.


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

  1. Add the following properties to the Liquibase properties file:
changelog-file: 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 placed the jar file in the liquibase/lib install directory, do not specify the classpath property in the Liquibase properties file. Otherwise, specify the driver path as shown in the preceding example.

To apply a Liquibase Pro key to your project, add the following property to the Liquibase properties 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 createTable changeset as follows:
  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 a database UI tool, ensure that your database contains the table you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.