ConnectionInfoProvider - Scoped, Global

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 5분
  • The ConnectionInfoProvider API provides methods to select connection information through the connection alias.

    You can use this API in scoped applications or within the global scope. In scoped scripts, use the sn_cc namespace identifier.

    This function retrieves connection information identified by the given connection alias.

    var provider = new sn_cc.ConnectionInfoProvider();
    
    // get a jdbc connection in the current domain with the alias ID
    //     "6219afbf9f03320021dd7501942e70fc"
    var connectionInfo = provider.getConnectionInfo("6219afbf9f03320021dd7501942e70fc");
    if (connectionInfo != null) {
      // get data map
      var datamap = connectionInfo.getDataMap();
      gs.info(datamap["name"]);
      gs.info(datamap["connection_url"]);
    
      // get the same values using getAttribute
      gs.info(connectionInfo.getAttribute("name"));
      gs.info(connectionInfo.getAttribute("connection_url"));
    
      // get credential attributes
      gs.info(connectionInfo.getCredentialAttribute("user_name"));
      gs.info(connectionInfo.getCredentialAttribute("password")); 
    
      // get extended attributes
      var extendedAttributes = connectionInfo.getExtendedAttributes();  
      gs.info(extendedAttributes["name1"]);
     }
    
     // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");
     if (connectionInfo != null) {
       // get data map
       var datamap = connectionInfo.getDataMap();
       gs.info(datamap["name"]);
     }
    

    ConnectionInfoProvider - ConnectionInfoProvider()

    Selects connection information through the connection alias.

    표 1. Parameters
    Name Type Description
    None

    ConnectionInfoProvider - getConnectionInfo(String aliasID)

    Retrieves a ConnectionInfo object identified by the given aliasID in the current domain.

    표 2. Parameters
    Name Type Description
    aliasID String Sys_id of a connection alias.
    표 3. Returns
    Type Description
    ConnectionInfo Information about the connection.
    var provider = new sn_cc.ConnectionInfoProvider();
    
    // get a jdbc connection in the current domain with the alias ID
    //     "6219afbf9f03320021dd7501942e70fc"
    var connectionInfo = provider.getConnectionInfo("6219afbf9f03320021dd7501942e70fc");

    ConnectionInfoProvider - getConnectionInfoByDomain(String aliasID, String domainID)

    Retrieves a ConnectionInfo object identified by the given aliasID for a specific domain.

    표 4. Parameters
    Name Type Description
    aliasID String Sys_id of a connection alias.
    domainID String Sys_id of a domain or global.
    표 5. Returns
    Type Description
    ConnectionInfo Connection information.
    var provider = new sn_cc.ConnectionInfoProvider();
    
    // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");