Using the REST interface with Db2 on Red Hat OpenShift

Using the Db2® Warehouse REST interface is extensively documented in the Db2 documentation. However, some differences exist in usage methods between Db2 Warehouse on Red Hat® OpenShift® and the standalone Db2 Warehouse.

Enablement
The biggest difference is in enablement. To enable the REST interface on Red Hat OpenShift, follow the steps in Enabling the Db2 REST interface.
Db2 REST documentation that can be used as is
The following topics apply as is to the REST interface on Red Hat OpenShift:
Db2 REST documentation that requires some changes for Red Hat OpenShift
The following topics apply to the REST interface on Red Hat OpenShift, but with some differences:
  • Defining a REST SQL service: The sentence, "Before you define a service, you must first set up the REST server metadata, either by activating and initialing REST service capability or by issuing the following REST call" does not apply to the REST interface on Red Hat OpenShift because the service is enabled differently. You must issue the REST call that is described in Enabling the Db2 REST interface.
  • Operating a REST server: Replace all commands that begin with docker exec containername with the Red Hat OpenShift command oc exec podname.
  • Authenticating REST commands: If you are authenticating against the Red Hat OpenShift database instance, you do not need to specify valid values for dbHost, dbName, and dbPort because they are pre-specified in the Db2 Warehouse REST implementation on Red Hat OpenShift. However, you must pass some values when authenticating or the request is rejected. For dbHost and dbName, if you pass empty strings the pre-specified values are used. For dbPort, if you pass -1 the pre-specified values are used. The following example would be valid:
    json = {
    "dbParms": {
    "dbHost": "",
    "dbName": "",
    "dbPort": -1,
    "isSSLConnection": true,
    "username": username,
    "password": password
    },
    "expiryTime": "24h"
    }

    If you wish to authenticate with a different database instance, you can specify the parameters for that database instance as necessary.