Connect FineReport to MaxCompute

更新时间:
复制 MD 格式

MaxCompute allows you to access data from your MaxCompute project in FineReport. You can use simple drag-and-drop operations to create complex reports. This topic describes how to use the MaxCompute JDBC driver to connect FineReport to a MaxCompute project and analyze reports.

Background information

FineReport is an enterprise-level web reporting tool developed by FanRuan Software Co., Ltd. Its zero-code philosophy makes it easy to learn, use, and powerful. You can use simple drag-and-drop operations to create complex reports and meet various requirements, such as a variety of report displays, interactive analysis, data entry, permission management, scheduled jobs, printing and exporting, portal management, and mobile applications. For more information about FineReport, see FineReport.

Prerequisites

Before you begin, ensure the following requirements are met:

  • You have created a MaxCompute project.

    For more information about how to create a MaxCompute project, see Create a MaxCompute project.

  • You have an AccessKey ID and an AccessKey Secret with permissions to access the MaxCompute project.

    Go to the AccessKey Management page to obtain an AccessKey ID and an AccessKey Secret.

  • You have installed FineReport (v10.0 or later), which has a built-in MaxCompute Connector.

    For more information about how to install and start FineReport, see Designer Installation.

    This topic uses FineReport v10.0 as an example.

  • You have downloaded the MaxCompute JDBC driver (v3.2.8 or later), which is packaged as the jar-with-dependencies JAR package.

    This topic uses MaxCompute JDBC driver v3.2.9 as an example.

Procedure

Follow these steps to connect FineReport to MaxCompute:

  1. Step 1: Place the MaxCompute JDBC driver

    Place the MaxCompute JDBC driver JAR package in the FineReport driver directory so that FineReport can use this driver to access your MaxCompute project.

  2. Step 2: Connect FineReport to MaxCompute

    Configure the connection parameters to connect FineReport to your MaxCompute project.

  3. Step 3: Use FineReport to query and analyze data

    Access and visually analyze data from your MaxCompute project in FineReport.

Step 1: Place the MaxCompute JDBC driver

  1. Optional: If the xercesImpl.jar file exists in the %FineReport%\lib directory, download xercesImpl-2.11.0.jar and use it to replace the existing xercesImpl.jar file.

    If the xercesImpl.jar file does not exist in the directory, skip this step.

  2. Place the downloaded MaxCompute JDBC driver JAR package, odps-jdbc-3.2.9-jar-with-dependencies.jar, in the %FineReport%\webapps\webroot\WEB-INF\lib directory.

    放置目录

Step 2: Connect FineReport to MaxCompute

  1. Start FineReport.

  2. From the top menu bar, choose Server > Define Data Connection.

    定义数据连接

  3. In the Define Data Connection dialog box, click the 添加 icon, select JDBC, and configure the following parameters.

    JDBC连接

    Parameter

    Description

    Database

    Select Others from the drop-down list.

    Driver

    The driver used to connect to the MaxCompute project. The value is fixed at com.aliyun.odps.jdbc.OdpsDriver. You must enter this value manually. You cannot select it from a drop-down list.

    User name

    The AccessKey ID that has permissions to access the target MaxCompute project.

    Go to the AccessKey Management page to obtain the AccessKey ID.

    Password

    The AccessKey Secret that corresponds to the AccessKey ID.

    Go to the AccessKey Management page to obtain the AccessKey Secret.

    URL

    The URL used to connect to the MaxCompute project. The format is jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>[&interactiveMode={true|false}]. When you configure the URL, remove the angle brackets (<>). The parameters are as follows:

    • <MaxCompute_endpoint>: Required. The endpoint of the region where your MaxCompute project is located.

      For information about the endpoints for each region, see Endpoints.

    • <MaxCompute_project_name>: Required. The name of your MaxCompute project.

      This is the name of the MaxCompute project, not the workspace name. You can log on to the MaxCompute console, switch to the correct region in the upper-left corner, and then find the project name on the Project Management tab.

    • interactiveMode: Optional. Enables or disables the query acceleration feature.

      To enable the query acceleration feature, append &interactiveMode=true to the URL. For more information about the query acceleration feature, see Query acceleration.

    Encoding

    We recommend selecting UTF-8.

  4. Above the parameters, click Test Connection. After the connection is successful, click OK to save the connection.

    If you encounter issues with the connection, see Data Connection FAQ.测试连接

    Note

    When you test the connection, we recommend that you click Advanced, click Connection Pool Attributes, and set Validate Connection Before Checkout to No. Otherwise, the connection test might be slow.

Step 3: Query and analyze data

In FineReport, you can query and analyze data from the connected MaxCompute project. FineReport saves and displays the data as a two-dimensional table in the dataset management panel. For detailed instructions, see FineReport Help.

  • View all tables

    On the FineReport page, click the 添加 icon, select Database Query, and then select the data connection that you created in Step 2. FineReport automatically loads all tables from the MaxCompute project.

    查看所有表

  • View the table schema

    On the FineReport page, click the 添加 icon, select Database Query, and then select the data connection that you created in Step 2. After you write an SQL query, you can view the table schema in the Template Dataset area.

    查看表结构

    Note

    If you receive a "Dataset configuration error" message, see Usage notes for a solution.

  • View table data

    On the FineReport page, click the 添加 icon, select Database Query, and then select the data connection that you created in Step 2. After you write an SQL query, you can click the 预览 icon to view the table data.

    查看表数据

  • Visualize data

    After you create a database query, you can click the 图标 icon on the right, insert elements, and configure their properties to analyze data based on your business needs.

    可视化分析数据