Create a server to connect to Db2

This task shows you how to create a IBM® z/OS® Connect server and configure a connection to a Db2®.

Before you begin

Ensure that the following tasks are complete:
  1. Install and configure Db2 native REST services. The procedure is described in Creating and enabling Db2 native REST services.
  2. Install IBM z/OS Connect v3.0.29 or later. For more information, see Installing IBM z/OS Connect.
  3. Install the API Toolkit, see Installing z/OS Explorer and the z/OS Connect API toolkit.

Pre-built services and an API are provided to simplify testing of this scenario.

About this task

This task guides you through the following:
  • Creating a IBM z/OS Connect server with ready-to-use services and an API for the employee Db2 native REST services.
  • Configuring a connection between your IBM z/OS Connect server and Db2.
  • Testing the connection to Db2 using the supplied API.

Procedure

  1. Enter the following command to create a server:
    zosconnect create db2ProjectManager --template=zosconnect:sampleDb2ProjectManager
    The following artifacts are created:
    • An projectManager API archive file, projectManager.aar, in the directory <WLP_USER_DIR>/servers/db2ProjectManager/resources/zosconnect/apis.
    • Three service archive files, employeeList.sar, employeeDetails.sar, and employeeUpdate.sar, in the directory <WLP_USER_DIR>/servers/db2ProjectManager/resources/zosconnect/services.
    • A server.xml configuration file in the directory <WLP_USER_DIR>/servers/db2ProjectManager.
  2. Customize the IBM z/OS Connect server.xml configuration file.
    1. Update the REST client connection element to define a connection to Db2:
      <zosconnect_zosConnectServiceRestClientConnection id="db2Conn" host="localhost" port="1234" /> 
      1. If your server and Db2 instance are on different LPARs, replace the host value localhost with the host name or IP address of the LPAR hosting your Db2 instance.
      2. Replace the port value 1234 with the port that your Db2 instance is configured to use.
      3. Enable security if required by Db2 configuration. For more information, see the Configuring security for a REST client connection to Db2 topic.
    2. Update the httpPort for inbound connections to IBM z/OS Connect in the httpEndpoint element, if necessary:
      <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="-1"/> 

What to do next

Test your newly created server.