I. Overview
1. Version
Function change | ||
Built-in driver update Note: Upgrade does not update built-in drivers. |
1) FineReport can connect to MySQL 5.x.x database through its own JDBC driver.
2) The database used in this chapter is MySQL 5.6.31. Please contact technical support if you meet problems with data connection.
II. Configuration information
1. Info
Driver | URL | Download driver | Database types supported |
---|---|---|---|
com.mysql.jdbc.Driver or org.gjt.mm.mysql.Driver | jdbc:mysql://localhost:port/database name | FineReport built-in mysql-connector-java-5.1.49.jar driver package, no download required | MySQL8.0;MySQL_5.6.31;MySQL_5.5;MySQL_5.5.5;MySQL_5.6.35;MySQL_5.7;MySQL_5.6.37;MySQL_5.5.46;MySQL_6.5;MySQL_5.7.16;MySQL_5.6.29;MySQL_5.6.22;MySQL_5.6.34;MySQL_5.6.28;MySQL_5.1; |
Official suggestion:
For better performance, users using Mysql 5.5, 5.6, 5.7 are advised to change the Mysql database driver to version 5.1.37 for better performance.
Driver download: mysql-connector-java-5.1.37.jar
2. Place the driver
For versions 10.0.16 and later, skip this step.
Because this data connection uses the mysql-connector-java-5.1.49-bin.jar driver delivered with FineReport, there is no need to download the driver separately.
For version before 10.0.16, you need to replace and update the driver package: mysql-connector-java-5.1.49-bin.jar
The steps are as follows:
1) Delete MySQL connection driver in %FR_HOME%\webapps\webroot\WEB-INF\lib: mysql-connector-java-5.1.39-bin.jar or mysql-connector-java-8.0.17.jar.
2) Copy the downloaded driver to %FR_HOME%\webapps\webroot\WEB-INF\lib.
3) Restart the report server.
III. Steps to connect - designer
1. Create JDBC data connection
2. Define data connection
1) URL: jdbc:mysql://host name/database name
2) Click the drop-down box to select the code.
3. Test data connection
IV. Steps to connect - platform
1. Create a new data connection
The administrator logs in to the decision-making platform, clicks Manage > Data Connection > Data Connection Management, clicks New Data Connection, and selects MySQL under Commonly Used, as shown in the following figure:
Note: If a non-administrator user wants to configure a data connection, the administrator needs to assign him the authority to manage the data connection node under the system. For details, please refer to Data Connection Authorization.
Enter the corresponding data connection information according to the configuration information format in Section II.1 of this document. The advanced settings are optional. For details, please refer to: [Platform] Configure Data Connection . After entering the information, the interface is as shown below:
Note: If there are garbled Chinese characters and dates (report & preview), you can modify the URL to:
jdbc:mysql://localhost:port number/<database name>?generateSimpleParameterMetadata=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
serverTimezone=Asia/Shanghai -- The setting is based on "Shanghai time zone"
characterEncoding=utf8 -- encoding conversion
For details about Chinese garbled characters in MySQL databases, please refer to: MySQL Database Chinese Garbled
2. Test the connection
Click the Test Connection, if the Connection Successful prompt box pops up, it means that the connection to the database is successful, as shown in the following figure:
After selecting the mode, click the save button in the upper right corner, and the data connection is added successfully. As shown below:
3. Precautions
Use the solution in this article first. If you can't connect, you can try to use the plugin connection: [Platform] MySQL8 data connection plugin