Home

Constants and subprograms are desupported from DBMS_XDB package

Description

    This rule flags the use of deprecated constants and subprograms from the DBMS_XDB package.

    Starting from Oracle Database 18c, many constants and methods related to HTTP server management, MIME mappings, listener configuration, and FTP settings within the DBMS_XDB package are desupported.

    Examples of desupported constants and procedures include ADDHTTPEXPIREMAPPING, ADDMIMEMAPPING, SETHTTPPORT, and GETFTPPORT. Applications should migrate to use DBMS_XDB_CONFIG or newer administrative methods.

Key Benefits

  • Future Compatibility: Helps ensure that the code will continue to work with Oracle 18c and later versions without relying on deprecated DBMS_XDB functionality.
  • Modern Practices: Encourages moving toward modern database configuration methods using DBMS_XDB_CONFIG.
  • System Stability: Avoids runtime errors and unexpected behavior caused by using unsupported features.

 

Non-compliant Code Example

DECLARE
  v_http_endpoint VARCHAR2(100);
  v_protocol_tcp  VARCHAR2(100);
BEGIN
  -- These constants are desupported:
  v_http_endpoint := DBMS_XDB.XDB_ENDPOINT_HTTP;        --Non compliant code (Constants desupported from DBMS_XDB package)
  v_protocol_tcp  := DBMS_XDB.XDB_PROTOCOL_TCP;         --Non compliant code (Constants desupported from DBMS_XDB package)

 DBMS_XDB.SETHTTPPORT(8080);                        --Non compliant code (Subprogram desupported from DBMS_XDB package)

 DBMS_XDB.SETLISTENERENDPOINT(                      --Non compliant code (Subprogram desupported from DBMS_XDB package)
   endpoint => DBMS_XDB.XDB_ENDPOINT_HTTP2,  
   host     => 'LOCALHOST',                         
   port     => 8443,
   protocol => DBMS_XDB.XDB_PROTOCOL_TCPS);  -- HTTPS / TLS

  DBMS_OUTPUT.PUT_LINE('HTTP Endpoint: ' || v_http_endpoint);
  DBMS_OUTPUT.PUT_LINE('Protocol: ' || v_protocol_tcp);
END;

Compliant Code Example

DECLARE
  v_http_endpoint VARCHAR2(100);
  v_protocol_tcp  VARCHAR2(100);
BEGIN
  -- These constants are desupported:
  v_http_endpoint := DBMS_XDB_CONFIG.XDB_ENDPOINT_HTTP;        --Compliant code
  v_protocol_tcp  := DBMS_XDB_CONFIG.XDB_PROTOCOL_TCP;         --Compliant code

    DBMS_XDB_CONFIG.SETHTTPPORT(8080);                         --Compliant code

    DBMS_XDB_CONFIG.SETLISTENERENDPOINT(                       --Compliant code
   endpoint => DBMS_XDB_CONFIG.XDB_ENDPOINT_HTTP2,  
   host     => 'LOCALHOST',                         
   port     => 8443,
   protocol => DBMS_XDB_CONFIG.XDB_PROTOCOL_TCPS);  -- HTTPS / TLS

  DBMS_OUTPUT.PUT_LINE('HTTP Endpoint: ' || v_http_endpoint);
  DBMS_OUTPUT.PUT_LINE('Protocol: ' || v_protocol_tcp);
END;
Visual Expert 2025
 VEPLSQLRULE202