Ready to get started?

Download a free trial of the Xero WorkflowMax Driver to get started:

 Download Now

Learn more:

Xero WorkflowMax Icon Xero WorkflowMax JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Xero WorkflowMax.

Create a Data Access Object for Xero WorkflowMax Data using JDBI

A brief overview of creating a SQL Object API for Xero WorkflowMax data in JDBI.

JDBI is a SQL convenience library for Java that exposes two different style APIs, a fluent style and a SQL object style. The CData JDBC Driver for Xero WorkflowMax integrates connectivity to live Xero WorkflowMax data in Java applications. By pairing these technologies, you gain simple, programmatic access to Xero WorkflowMax data. This article walks through building a basic Data Access Object (DAO) and the accompanying code to read and write Xero WorkflowMax data.

Create a DAO for the Xero WorkflowMax Clients Entity

The interface below declares the desired behavior for the SQL object to create a single method for each SQL statement to be implemented.

public interface MyClientsDAO { //insert new data into Xero WorkflowMax @SqlUpdate("INSERT INTO Clients (Name, Name) values (:name, :name)") void insert(@Bind("name") String name, @Bind("name") String name); //request specific data from Xero WorkflowMax (String type is used for simplicity) @SqlQuery("SELECT Name FROM Clients WHERE Name = :name") String findNameByName(@Bind("name") String name); /* * close with no args is used to close the connection */ void close(); }

Open a Connection to Xero WorkflowMax

Collect the necessary connection properties and construct the appropriate JDBC URL for connecting to Xero WorkflowMax.

To connect to the WorkflowMax API, obtain an APIKey and AccountKey from Xero. This can only be done by contacting Xero support (

After obtaining an API Key and Account Key, set the values in the APIKey and AccountKey connection properties. Once these are set, you are ready to connect.

Built-in Connection String Designer

For assistance in constructing the JDBC URL, use the connection string designer built into the Xero WorkflowMax JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

java -jar cdata.jdbc.xeroworkflowmax.jar

Fill in the connection properties and copy the connection string to the clipboard.

A connection string for Xero WorkflowMax will typically look like the following:


Use the configured JDBC URL to obtain an instance of the DAO interface. The particular method shown below will open a handle bound to the instance, so the instance needs to be closed explicitly to release the handle and the bound JDBC connection.

DBI dbi = new DBI("jdbc:xeroworkflowmax:APIKey=myApiKey;AccountKey=myAccountKey;"); MyClientsDAO dao =; //do stuff with the DAO dao.close();

Read Xero WorkflowMax Data

With the connection open to Xero WorkflowMax, simply call the previously defined method to retrieve data from the Clients entity in Xero WorkflowMax.

//disply the result of our 'find' method String name = dao.findNameByName("Cynthia"); System.out.println(name);

Write Xero WorkflowMax Data

It is also simple to write data to Xero WorkflowMax, using the previously defined method.

//add a new entry to the Clients entity dao.insert(newName, newName);

Since the JDBI library is able to work with JDBC connections, you can easily produce a SQL Object API for Xero WorkflowMax by integrating with the CData JDBC Driver for Xero WorkflowMax. Download a free trial and work with live Xero WorkflowMax data in custom Java applications today.