This article explains how to use Treasure Data with JasperSoft iReport, by leveraging our JDBC driver. By combining Treasure Data with JasperSoft, you can process terabytes of data on the cloud, while continuing to use your existing JasperSoft instances.
- Basic knowledge of Treasure Data, including our Quickstart Guide.
|Don't have time to setup JasperSoft + Treasure Data? Leverage our Setup Consultation Service.|
Download JasperSoft iReport
You can download JasperSoft iReport from the link below. Version 4.6.0 was used for this article.
Download the Treasure Data JDBC Driver
You can download the driver itself from the link below. The driver is still in beta; any feedback is appreciated.
|This driver only works with Treasure Data. It does not run on other environments, such as your local Hadoop/Hive cluster.|
Add Treasure Data as Data Source
Let’s add Treasure Data as Jasper’s data source. Please follow the procedure below.
Step1: Add the JDBC Driver Jar to Classpath
Preferences -> iReport Tab -> Classpath, and press the
Add Jar button. Select the downloaded JDBC driver and check the
Reloadable box in the table.
Step2: Create a New Data Source
Press the database icon, which is located near the ‘Empty datasource’ indicator. Add a new data source with type:
Database JDBC connection.
Step3: Configure your JDBC Connection
Configure your jdbc parameters as shown in the following figure. Please make sure to provide your credentials (your email + password).
|Treasure Data's JDBC driver will NOT appear in the "JDBC Driver" dropdown. Please click on the dropdown area and type `com.treasure_data.jdbc.TreasureDataDriver`.|
Step4: Create Reports
The procedure for this step is identical to creating reports with a JDBC source.
First, create a report by navigating to
File -> New -> Report. Make sure that your data source is set to “TreasureData” (or your name for our JDBC connection).
Here, the query is
SELECT code, COUNT(1) AS count FROM apache_log GROUP BY code
Some notes about this sample data:
- The data in this table is taken from a typical Apache log. The field
codecorresponds to HTTP status code. Essentially, we are counting the number of HTTP requests per status code.
Treasure Data does not have a pre-defined schema out of the box. We therefore need to add schema for the field named
codein order for the above query to work.
$ td table:show demo apache_log Name : demo.apache_log Type : log Count : 25000000 Schema : (
(The Schema article explains how to add/remove/modify schema on our system.)
The rest of the setup is exactly the same as any other report.