Ready to get started?

Download a free trial of the Monday.com Driver to get started:

 Download Now

Learn more:

Monday.com Icon Monday.com JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Monday.com.

Create a Data Access Object for Monday.com Data using JDBI



A brief overview of creating a SQL Object API for Monday.com 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 Monday.com integrates connectivity to live Monday.com data in Java applications. By pairing these technologies, you gain simple, programmatic access to Monday.com data. This article walks through building a basic Data Access Object (DAO) and the accompanying code to read Monday.com data.

Create a DAO for the Monday.com Invoices 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 MyInvoicesDAO { //request specific data from Monday.com (String type is used for simplicity) @SqlQuery("SELECT DueDate FROM Invoices WHERE Status = :status") String findDueDateByStatus(@Bind("status") String status); /* * close with no args is used to close the connection */ void close(); }

Open a Connection to Monday.com

Collect the necessary connection properties and construct the appropriate JDBC URL for connecting to Monday.com.

You can connect to Monday.com using either API Token authentication or OAuth authentication.

Connecting with an API Token

Connect to Monday.com by specifying the APIToken. Set the AuthScheme to Token and obtain the APIToken as follows:

  • API tokens for admin users
    1. Log in to your Monday.com account and click on your avatar in the bottom left corner.
    2. Select Admin.
    3. Select "API" on the left side of the Admin page.
    4. Click the "Copy" button to copy the user's API token.
  • API tokens for non-admin users
    1. Click on your profile picture in the bottom left of your screen.
    2. Select "Developers"
    3. Click "Developer" and then "My Access Tokens" at the top.
    4. Select "Show" next to the API token, where you'll be able to copy it.

Connecting with OAuth Authentication

Alternatively, you can establish a connection using OAuth (refer to the OAuth section of the Help documentation).

Built-in Connection String Designer

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

java -jar cdata.jdbc.monday.jar

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

A connection string for Monday.com will typically look like the following:

jdbc:monday:APIToken=eyJhbGciOiJIUzI1NiJ9.yJ0aWQiOjE0MTc4NzIxMiwidWlkIjoyNzI3ODM3OSwiaWFkIjoiMjAyMi0wMS0yMFQxMDo0NjoxMy45NDFaIiwicGV;

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:monday:APIToken=eyJhbGciOiJIUzI1NiJ9.yJ0aWQiOjE0MTc4NzIxMiwidWlkIjoyNzI3ODM3OSwiaWFkIjoiMjAyMi0wMS0yMFQxMDo0NjoxMy45NDFaIiwicGV;"); MyInvoicesDAO dao = dbi.open(MyInvoicesDAO.class); //do stuff with the DAO dao.close();

Read Monday.com Data

With the connection open to Monday.com, simply call the previously defined method to retrieve data from the Invoices entity in Monday.com.

//disply the result of our 'find' method String dueDate = dao.findDueDateByStatus("SENT"); System.out.println(dueDate);

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