Start of change

Managing Db2 REST services

You can use Db2 as a REST service provider. Db2 defines a REST service as a package. Each package contains a single static SQL statement, and information about each REST service package is stored in a user-defined table, SYSIBM.DSNSERVICE.

Before you begin

You must be authorized to access SYSIBM.DSNSERVICE. You can use the following statement to grant access:
GRANT SELECT ON TABLE SYSIBM.DSNSERVICE TO PUBLIC;
PUBLIC is site-specific.

About this task

You can use Db2 Admin Tool to display information about Db2 REST services, start and stop them, and free the corresponding package for a REST service.

For instructions on how to create a REST service in Db2 Admin Tool, see Creating a Db2 REST service.

Procedure

To manage Db2 REST services:

  1. On the DB2 Administration Menu (ADB2) panel, specify option 1, and press Enter.
  2. On the System Catalog (ADB21) panel, specify option RS, and press Enter.
    If no REST services exist, the Create Rest Service (ADB21RSB) panel is displayed so that you can create one. Otherwise, the REST Services (ADB21RS) panel is displayed with information about each REST service from SYSIBM.DSNSERVICE:
     ADB21RS n ---------------------- DC1A Rest Services ---------- Row 1 to 4 of 4 
                                                                          More:    >
     Line commands:                                                                 
      DIS - Display REST service  DISG - Display REST group  F - Free service       
      K - Package  SQ - Show SQL  STA - Start REST service  STO - Stop REST service 
      ? - Show all line commands                                                    
                                              
     Sel  Collection        Name           E Description                            
          *                 *              * *                                      
     ---- ----------------> -------------- - -------------------------------------> 
          ASMCOL            ASMSELECT      Y Select department na    
          db2ar             getdb2metric   Y Select metrics for table abc  
          ASMCOL            ASMSELECT2     Y Select my tables        
          ASUCOL            ASUSELECT9     Y Select my tables        
     ******************************* END OF DB2 DATA *******************************
                                                                                    
                                                                                    

    For a detailed description of the panel columns and line commands, see Option RS. REST Services.

  3. Take one or more of the following actions as needed:
    • To display the status of a REST service: Use the DIS or DISG line command. (DISG displays the status on all members of the data sharing group.) Db2 Admin Tool issues the Db2 command DIS RESTSVC.
    • To display information about the package that contains the rest service: Use the K line command.
    • To view the SQL statement in the REST service package: Use the SQ line command.
    • To start a service: Use the STA or STAG line command. (STAG starts the service on all members of the data sharing group.) Db2 Admin Tool issues the Db2 command STA RESTSVC.
    • To stop a service: Use the STO or STOG line command. (STOG stops the service on all members of the data sharing group.) Db2 Admin Tool issues the Db2 command STO RESTSVC.
    • To free the package that contains the REST service: Use the F line command. After you free the package and return to this panel, the service is no longer listed.
End of change