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-dependenciesJAR 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:
-
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.
-
Step 2: Connect FineReport to MaxCompute
Configure connection parameters to connect FineReport to your MaxCompute project.
-
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
-
Optional: If
%FineReport%\libin the FineReport installation directory containsxercesImpl.jar, download xercesImpl-2.11.0.jar while signed in to FineReport, and replacexercesImpl.jar.If the directory does not contain
xercesImpl.jar, skip this step. -
Place the downloaded MaxCompute JDBC driver JAR file,
odps-jdbc-3.2.9-jar-with-dependencies.jar, in the%FineReport%\webapps\webroot\WEB-INF\libdirectory 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
-
Start FineReport.
-
In the top menu bar, choose .
The Server dropdown menu includes several options, such as Define Data Connection, server dataset, and Report Platform Management.
-
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=trueto the URL. For more information about the query acceleration feature, see Query acceleration.
Encoding
We recommend selecting UTF-8.
- <MaxCompute_endpoint>: Required. The endpoint of the region where the MaxCompute project resides.
-
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.
NoteTo 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
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
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.NoteIf a "Dataset configuration error" message appears, see Notes for a solution.
-
View table data
In the FineReport interface, click the
icon, select Database Query, select the data connection created in Step 2, and write an SQL query statement. You can then click the
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.