Connect FineReport to MaxCompute

更新时间:
复制 MD 格式

This topic describes how to use the MaxCompute JDBC driver to connect FineReport to a MaxCompute project for report analysis.

Background information

FineReport is an enterprise-grade web reporting tool built on a zero-code philosophy. By using simple drag-and-drop operations, you can create complex reports and meet various requirements, including diverse report visualizations, interactive analysis, data entry, permission management, scheduled tasks, printing and exporting, portal management, and mobile applications. For more information about FineReport, see FineReport.

Prerequisites

Before you begin, ensure that you meet the following requirements:

  • 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 to access the MaxCompute project.

    You can obtain an AccessKey ID and an AccessKey Secret on the AccessKey Management page.

  • You have installed FineReport (v10.0 or later) with the built-in MaxCompute Connector.

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

    The FineReport version used in this document is v10.0.

  • You have downloaded the MaxCompute JDBC driver (v3.2.8 or later) that contains the jar-with-dependencies JAR file.

    The examples in this topic use version 3.2.9 of the MaxCompute JDBC driver.

Procedure

To connect FineReport to MaxCompute, perform the following steps:

  1. Step 1: Place the MaxCompute JDBC driver

    Place the MaxCompute JDBC driver JAR file in the driver directory of FineReport. This allows FineReport to access your MaxCompute project.

  2. Step 2: Connect FineReport to MaxCompute

    Configure connection parameters to connect FineReport to your MaxCompute project.

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

    Access data from your MaxCompute project in FineReport and perform visual analysis.

Step 1: Place the MaxCompute JDBC driver

  1. Optional: If %FineReport%\lib in the FineReport installation directory contains xercesImpl.jar, download xercesImpl-2.11.0.jar while signed in to FineReport, and replace xercesImpl.jar.

    If the directory does not contain xercesImpl.jar, skip this step.

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

    After you place the file, verify that the odps-jdbc-3.2.9-jar-with-dependencies.jar file is in this directory.

Step 2: Connect FineReport to MaxCompute

  1. Start FineReport.

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

    The Server dropdown menu includes several options, such as Define Data Connection, server dataset, and Report Platform Management.

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

    Parameter

    Description

    Database

    From the drop-down list, select Others.

    Driver

    Enter com.aliyun.odps.jdbc.OdpsDriver. This value is not available in the drop-down list.

    Username

    The AccessKey ID authorized to access the target MaxCompute project.

    You can obtain an AccessKey ID on the AccessKey Management page.

    Password

    The AccessKey Secret corresponding to the AccessKey ID.

    You can obtain an AccessKey Secret on the AccessKey Management page.

    URL

    The connection URL for the MaxCompute project. The format is jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>[&interactiveMode={true|false}]. Replace the placeholders within the angle brackets (<>). The parameters are described as follows:

    • <MaxCompute_endpoint>: Required. The endpoint of the region where the MaxCompute project resides.

      For information about endpoints in different regions, see Endpoints.

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

      This value is the MaxCompute project name, not the workspace name. You can find the MaxCompute project name on the Project Management tab in the MaxCompute console after you select the correct region.

    • interactiveMode: Optional. The switch for the query acceleration feature.

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

    Encoding

    We recommend selecting UTF-8.

  4. Click Test Connection. If the connection succeeds, click OK.

    After a successful test, a "Connection Successful" message appears. If you encounter any connection issues, see Data Connection FAQ.

    Note

    To improve connection speed, click Advanced and then Connection Pool Attributes, and set Validate Before checkout to No.

Step 3: Query and analyze data

After connecting, you can use FineReport to 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. The following operations are available. For detailed instructions, see FineReport Help.

  • View all tables

    In FineReport, click the Add 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 structure

    In the FineReport interface, click the Add icon and select Database Query. Select the data connection created in Step 2 and write an SQL query statement. You can then view the table structure information in the Template Dataset area.

    Note

    If a "Dataset configuration error" message appears, see Notes for a solution.

  • View table data

    In the FineReport interface, click the add icon, select Database Query, select the data connection created in Step 2, and write an SQL query statement. You can then click the preview icon to view the table data.

  • Visualize and analyze data

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