Connect to MySQL

  • Last update:  2022-01-17
  • I. Overview

    1. Version

    Designer

    JAR

    Function change

    10.0.15

    2021-04-09

    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


      DriverURL
    Download driverDatabase types supported
    com.mysql.jdbc.Driver

    or

    org.gjt.mm.mysql.Driver

     jdbc:mysql://localhost:port/database nameFineReport built-in mysql-connector-java-5.1.49.jar driver package, no download requiredMySQL8.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.

    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

    1.png


    2. Define data connection

    1) URL: jdbc:mysql://host name/database name

    2) Click the drop-down box to select the code.

    2.png


    3. Test data connection

    3.png

    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.

    4.png

    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:

    5.png

    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:

    6.png

    After selecting the mode, click the save button in the upper right corner, and the data connection is added successfully. As shown below:

    7.png


    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

    Attachment List


    Theme: Data Preparation
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy