Skip to main content

Access Db2 Data Source through the NineData Gateway

NineData supports accessing Db2 data sources through a gateway, allowing you to connect to Db2 without providing an external address, even if it's in a private or dedicated network environment.

Prerequisites

  • The host where the gateway is deployed must be within the Db2 data source's intranet environment and must be able to access the Db2 data source smoothly through the intranet.
  • The host where the gateway is deployed must have internet access. If your host cannot access the internet and is within a local area network, you can deploy a proxy gateway. For more information, see Using a Proxy Gateway.

Step 1: Deploy the Gateway

Use this step when the gateway host can access the public internet. If the host can access only a local area network, use Proxy Gateway to deploy the gateway.

  1. Sign in to the NineData console on the host where you want to deploy the gateway.

  2. In the left navigation pane, click Datasource > Gateway.

  3. Click Create Gateway in the top right of the page.

  4. Configure the following parameters.

    ParameterDescription
    NameEnter a gateway name that is easy to search and manage. You can specify the name manually.
    EnvironmentSelect the operating system of the gateway host. NineData displays the corresponding gateway installation method. The following operating systems are supported:
    • Windows(x86_64)
    • Linux(x86_64)
    • macOS
    Access RegionSelect the region closest to the gateway host to reduce network latency.
    AdvancedNo configuration required.
  5. Follow the displayed installation method to install and configure the gateway on the deployment host. After the configuration is complete, the connection diagram on the right changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  6. Click Create Datasource, select the data source to add in the dialog, and proceed to Step 2.

Step 2: Access Db2 Data Source

  1. On the Create Datasource page, configure the parameters in the table.

    Parameter
    Description
    NameEnter the name of the data source for easy identification and management in the future. Use a meaningful name.
    ConnectionChoose Gateway.
    GatewaySelect the gateway ID deployed in Step 1.
    HostEnter the access address and port for the Db2 data source.
    • If Db2 is installed on the local machine: Enter localhost or 127.0.0.1 for the address and the actual access port for Db2.
    • If Db2 is installed on another host within the intranet: Enter the intranet IP of that host for the address and the actual access port for Db2.
    DATABASESpecify the database name to connect to.
    DB AccountEnter the Db2 login username.
    DB PasswordEnter the Db2 login password.
    Access RegionChoose the region closest to the location of your Db2 host to effectively reduce network latency.
    EnvironmentSelect the environment that matches the business purpose of the data source. The default provides the PROD and DEV environments, and also supports you to create a custom environment.
    Note: In organization mode, the database environment can also be applied to permission policy management. For example, the default Prod Admin role only supports access to data sources in the PROD environment and cannot access data sources in other environments. For more information, see Managing Roles.
  2. After configuring the parameters, click Connection Test next to Create Datasource to verify that NineData can reach the data source. When Connection Successfully appears, click Create Datasource to add the data source. If the test fails, review the connection settings and run the test again.

Appendix: Using a Proxy Gateway

If the gateway host cannot access the public internet, use a proxy gateway. Prepare two hosts in the same LAN that can reach each other:

  • Host A: A host that can access the public internet.
  • Host B: The host where you deploy the gateway.

Create a gateway on Host A to act as a proxy so Host B can connect to the NineData server through it.

Procedure

  1. Sign in to the NineData console on Host A.

  2. In the left navigation bar, click Datasource > Gateway.

  3. Click Create Gateway in the top right of the page.

  4. Configure the following parameters.

    ParameterDescription
    NameEnter a gateway name that is easy to search and manage. You can specify the name manually.
    EnvironmentSelect the operating system of the gateway host. NineData displays the corresponding gateway installation method. The following operating systems are supported:
    • Windows (x86_64)
    • Linux (x86_64)
    • macOS
    Access RegionSelect the region closest to the gateway host to reduce network latency.
    AdvancedNo configuration is required.
  5. Follow the displayed installation method to install and configure the gateway on Host A. After the configuration is complete, the connection diagram on the right changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  6. Click Completed and back to List, and then click Create Gateway in the top right of the page again.

  7. In Environment, select the operating system of Host B.

  8. Click Advanced, select Use Proxy, and open the dropdown under Proxy. Select the gateway created on Host A.

    tip

    NineData opens a proxy port on Host A for Host B. When the page shows xxx has enabled proxy function, port xxx, the proxy gateway is ready.

  9. Follow the displayed installation steps to install the gateway on Host B.

  10. Wait until the connection diagram on the right changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  11. Click Create Datasource to proceed to Step 2.