![]() |
VOOZH | about |
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 Productboard integrates connectivity to live Productboard data in Java applications. By pairing these technologies, you gain simple, programmatic access to Productboard data. This article explains how to build a basic Data Access Object (DAO) and the accompanying code to read Productboard data.
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 MyFeaturesDAO {
//request specific data from Productboard (String type is used for simplicity)
@SqlQuery("SELECT FROM Features WHERE IsArchived = :isArchived")
String findByIsArchived(@Bind("isArchived") String isArchived);
/*
* close with no args is used to close the connection
*/
void close();
}
Collect the necessary connection properties and construct the appropriate JDBC URL for connecting to Productboard.
To authenticate to ProductBoard, and connect to your own data or to allow other users to connect to their data, you can use API Key authentication.
To authenticate using an API Key, you need to obtain your API Key from your ProductBoard workspace settings.
You can then connect by setting the AuthScheme to APIKey and providing your API key:
For assistance in constructing the JDBC URL, use the connection string designer built into the Productboard JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.api.jar
Fill in the connection properties and copy the connection string to the clipboard.
👁 Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)A connection string for Productboard will typically look like the following:
jdbc:api:Profile=C:\profiles\Productboard.apip;AuthScheme=APIKey;ProfileSettings='APIKey=your_api_key';
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:api:Profile=C:\profiles\Productboard.apip;AuthScheme=APIKey;ProfileSettings='APIKey=your_api_key';");
MyFeaturesDAO dao = dbi.open(MyFeaturesDAO.class);
//do stuff with the DAO
dao.close();
With the connection open to Productboard, simply call the previously defined method to retrieve data from the Features entity in Productboard.
//disply the result of our 'find' method
String = dao.findByIsArchived("false");
System.out.println();
Since the JDBI library is able to work with JDBC connections, you can easily produce a SQL Object API for Productboard by integrating with the CData JDBC Driver for Productboard. Download a free trial and work with live Productboard data in custom Java applications today.
Connect to live data from Productboard with the API Driver
Connect to Productboard