Configuring your Db2 connection with Basic Authentication in Red Hat CodeReady Workspaces

Create the right files you need to configure aDb2 connection using Basic Authentication in Red Hat CodeReady Workspaces.

Before you begin

The following tasks must be completed:
  1. Downloading the z/OS Connect Designer image.
  2. Setting up Db2 native REST services.
  3. Fork the z/OS Connect Designer Db2 sample project.
  4. Creating the Db2 tutorial workspace in Red Hat CodeReady Workspaces.
  5. Optional: Encrypt Passwords using Red Hat CodeReady Workspaces.

About this task

This topic is applicable to: Content applicable to
application developers

Important: Ensure your Red Hat CodeReady Workspaces is running before following these steps.

Procedure

  1. Navigate to the employees-api/start/src/main/liberty/config directory.

    On the left hand side navigation within the explorer view of your Red Hat CodeReady Workspaces expand the project folders so employees-api/start/src/main/liberty/config is visible.

    Figure 1. Navigate to the config directory.
    Navigate to the config directory.
  2. Create the db2.xml file.

    Right click the config directory and select New File.

    Figure 2. Selecting New File.
    Selecting New File.

    Name the file db2.xml and click OK.

    Figure 3. Creating the db2.xml file.
    Creating the db2.xml file.
  3. In the newly created db2.xml file paste the following content.
    <?xml version="1.0" encoding="UTF-8" ?>
    <server description="Default server">
        <featureManager>
            <feature>zosconnect:db2-1.0</feature>
        </featureManager>
        <zosconnect_credential user="${DB2_USERNAME}" password="${DB2_PASSWORD}" id="commonCredentials"/>
        <zosconnect_db2Connection id="db2Conn" host="${DB2_HOST}" port="${DB2_PORT}" credentialRef="commonCredentials"/> 
    </server>

    The file will save automatically.

    Figure 4. Content pasted into the db2.xml file.
    Content pasted into the db2.xml file.

Results

You have successfully configured the db2.xml file needed to connect to Db2.

What to do next

Start the z/OS Connect Designer tooling and import your OpenAPI document in, Starting the z/OS Connect Designer in Red Hat CodeReady Workspaces.