Copying Db2 REST services
You can use the DSN BIND SERVICE subcommand with the COPY option to copy existing REST services to either a local or remote Db2 server.
Before you begin
- See BIND SERVICE subcommand (DSN) for information about required authorization to issue the BIND SERVICE subcommand. Additionally, you must hold the COPY privilege or its equivalent at the local server.
- The local server must be at least Db2 12 for z/OS® with REST services versioning enabled. See REST services versioning.
- When copying to another location, the remote server must be at least Db2 12 for z/OS with REST services versioning enabled.
- Only versioned services can be copied. Copying version-less services is not supported.
Procedure
To copy a REST service, specify the new collection-id using the SERVICE option. Use the
COPY and COPYVER options to specify the collection-id, service
name, and version-id of an existing REST service you want to copy from.
Other bind options may be optionally specified, see BIND SERVICE subcommand (DSN) for more
options information.
Examples
Example 1: To copy the existing REST service "simpleTests"."simpleSelect1" with a
version-id of V1, to another collection-id, "finalTests", on
the local server, issue the following DSN subcommand.
BIND SERVICE("finalTests") COPY("simpleTests"."simpleSelect1") COPYVER(V1)Example 2: The following example copies the existing REST service
"payroll"."getEmployeeSalary" with a version-id of Ver2, to a remote server with
the location-name PRODSYS. The new service has the same
collection-id as the original service. The QUALIFIER option is also specified for
the new service which determines the implicit qualifier for unqualified names of tables, views,
indexes, and aliases contained in the service created on the PRODSYS system. Lastly, the DESCRIPTION
option is used to describe the newly copied
service.
BIND SERVICE(PRODSYS."payroll") COPY("payroll"."getEmployeeSalary") COPYVER(Ver2) QUALIFIER(PRODQUAL) DESCRIPTION('This is the PRODSYS copy of getEmployeeSalary')