Skip to content

Instantly share code, notes, and snippets.

@saptak
Last active September 2, 2015 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saptak/46b79bd2857f803908c9 to your computer and use it in GitHub Desktop.
Save saptak/46b79bd2857f803908c9 to your computer and use it in GitHub Desktop.

Using JReport to visualize data with the Hortonworks Data Platform

###Introduction

JReport is a embedded BI reporting tool can easily extract and visualize data from the Hortonworks Data Platform 2.3 using the Apache Hive JDBC driver. You can then create reports, dashboards, and data analysis, which can be embedded into your own applications.

In this tutorial we are going to walkthrough the folllowing steps to demonstrate Apache Hive with JReport:

  1. Install the Apache Hive JDBC driver with JReport.
  2. Create a new JReport Catalog to manage the Hive connection.
  3. Use JReport Designer to query the data and create a report.

###Prerequisite

###Steps

####Step 1: Install the Apache Hive JDBC driver with JReport. Hive provides standard JDBC connectivity to easily integrate with JReport. For general instruction to install the Hive JDBC driver see http://hortonworks.com/hadoop/hive/.

  1. Download Apache Hive JDBC Driver and Hadoop common library.
  2. Copy the JDBC driver and Hadoop common library in the lib folder %REPORTHOME%\lib\ For Windows, copy the JDBC driver jar file into the C:\JReport\Designer\lib folder.
C:\JReport\Designer\lib\hive-jdbc-1.2.1.2.3.0.0-2557-standalone.jar
C:\JReport\Designer\lib\hadoop-common-2.7.1.jar
  1. Add the file path into the JReport CLASSPATH variable %REPORTHOME%\bin\setenv.bat For Windows, edit the C:\JReport\Designer\bin\setenv.bat file, as in Figure 1.

Image of setenv.bat Figure 1: Edit the setenv.bat file.

####Step 2: Create a new JReport Catalog to manage the Hive connection.

  1. Click Create New -> Catalog…
  2. Provide a catalog file name and click “” to choose the file saving location.
  3. Click View -> Catalog Browser
  4. Right click on “Data Source 1” and select “Add JDBC Connection”.
  5. Enter the “Driver”, “URL”, “User” and “Password”, as in Figure 2.

Image of Add Connection Figure 2: Enter JDBC connection information in the Catalog Browser.

  1. Click “OK”, JReport will verify the connection and save all information.
  2. Add Tables and Views to the JReport Catalog by right-clicking on the connection node and choose “Add Table”. Now you can browse the schemas and add specific tables you wish to make available for building queries, as in Figure 3.

Image of Add Table Figure 3: Add tables in the Catalog Browser.

  1. Click “Done” once you add all necessary tables.

####Step 3: Use JReport Designer to query the data and create a report

  1. In Catalog Browser, right-click on “Queries” and select “Add Query…”.
  2. Define a JReport Query using the Query Editor, as in Figure 4. You may also import your own SQL statements.

Image of Query Editor Figure 4: Define SQL queries using the Query Editor.

  1. Click “OK” to close the Query Editor and click the “Save Catalog” button to save your progress to the catalog file.
  2. Use JReport Designer to query the data and create a report, as shown in Figures 5, 6 and 7.

Image of Table Wizard-Data Figure 5: Choose the dataset that you want to use.

Image of Table Wizard-Display Figure 6: Choose the data fields that you want to display.

Image of Designer View Figure 7: The resulting report that you can continue to modify.

  1. Use the chart wizard to add charts to an existing report, as shown in Figures 8 and 9.

Image of Chart Wizard Figure 8: Choose the data fields that you want to display in the chart.

Image of Report with Chart Figure 9: The resulting report after charts have been added.

Congratulations on creating a report on the Hortonworks Sandbox using JReport! Next, learn how to embed reports and dashboards directly into your own applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment