Connect to MS SQL Server

  • Last update:January 17, 2022
  • I. Overview

    1) You will learn to connect to a SQL Server database through the designer.

    2) This article uses Microsoft SQL Server 2008 as an example.

    II. Configuration info

    1. Version


    Designer
    JARFunction change
    10.0.152021-04-09

    Updated the built-in sqljdbc.jar driver package

    Note: Upgrade does not update built-in drivers



    2. Database configuration

      DriverURL
    Download driverSupported database versions

     com.microsoft.sqlserver.

    jdbc.SQLServerDriver

    jdbc:sqlserver://ip:port;databaseName=xxx  

    Note: If you want to connect to a non-default instance, you can change the URL to: jdbc:sqlserver://ip:port;instanceName=instanceName;databaseName=databaseName

    FR built-in sqljdbc.jar driver package, no download required

    SQL Server 2005

    SQL Server 2008

    SQL Server 2012

    SQL Server 2014

    SQL Server 2016

    SQL Server 2017

    Official advice:

    For better fetch performance, you are advised to replace the SQL Server database driver with sqljdbc.jar for SQL Server 2005, 2008, 2012, 2014, 2016, and 2017 versions.


    3. Place the driver

    Note: For versions 10.0.16 and later, skip this step.

    If the version before 10.0.16, you can choose to replace and update the driver package: sqljdbc.jar

    Delete driver package sqljdbc.jar under %FR_HOME%\webapps\webroot\WEB-INF\lib. And copy the downloaded driver package to the directory.

    III. Steps to connect - designer

    1. Create JDBC data connection

    1) Create a new JDBC connection, select SQL Server, and the Driver and the default URL will be loaded automatically. You can enter your database information.

    image.png

    2) Click Connection Pool Attributes. Generally, you just need to keep the default settings.

    image.png

    3) Modify the URL by entering the actual address of the database server. Fill in the User Name and the Password. Click Test Connection. Confirm if the connection is successful. If the connection is successful, click OK.

    image.png

    IV. Steps to connect - platform

    1. Create a new data connection

    1) Log in to the decision-making platform as an administrator, click Manage > Data Connection > Data Connection Management, and click New Data Connection, as shown in the following figure:

    Note: If a non-admin 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

    2) Select Microsoft SQL Server under the Commonly Used option, as shown in the following figure:

    5.png


    2. Configure data connection

    1) Enter the corresponding data connection information according to the actual situation, as shown in the following figure:

    6.png

    2) Click to Test Connection, or Click theClick to Connect Database under Pattern, if a successful connection prompt box pops up, it means that the database is successfully connected, as shown in the following figure:

    7.png

    After the connection is successful, the mode will automatically select the default value, as shown in the following figure:

    8.png

    Note 1: The original intention of the schema is to make it easier for other functions to read the data in the database, just select the "default value".

    Note 2: When using SQL statements when connecting to a multi-schema database, you need to search with the schema name prefix, such as SELECT * FROM [dbo].[asdfg]

    3) Click the save button in the upper right corner.


    3. Effect View

    After the Microsoft SQL Server database connection is successful, you can edit, rename, copy, delete and other operations on the platform, as shown in the following figure:

    9.png

    At the same time, the successfully configured data connection is automatically generated in the FineReport designer, as shown in the following figure:

    10.png

    V. Matters need attention

    1. Check if URL is correct

    1) Cut the field: ;databaseName=, enter the User Name and the Password of SQL Server, click [Test Connection], and confirm IP and port are correct.

    image.png

    2) Paste the field: ;databaseName=, enter the name of database to be connected, click [Test Connection], and confirm the instance name is correct.

    image.png


    2. Check the instance name

    Check if the instance name of database is consistent with the databaseName in URL.

    image.png

    image.png


    3. Check if connection to the remote server is enabled

    For SSMS, right click on the server, go to [Server Attributes > Connection], check Allow remote connection to this server.

    allow-remote-connection


    4. Check user status

    For SSMS, right click on the user, go to [Login Attributes > Status], check Allow to connect to database engine, and Enable login.

    image.png


    5. Check if TCP/IP protocol is enabled

    image.png


    6. Check if database service is enabled

    image.png


    7. Check network configurations

    Open sqlserver Configuration Manager, and check if Named Pipes and TCP/IP are enabled in sqlserver network configuration.

    SQL SERVER - FIX : ERROR : (provider: Named Pipes Provider, error: 40 -  Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )  - SQL Authority with Pinal Dave


    8. Check if the Port Number is correct

    TCP-IP


    9. Check if sp4 installation package is installed


    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