ConnectionInfoProvider - 범위가 지정됨, 전역

  • 릴리스 버전: Yokohama
  • 업데이트 날짜 2025년 01월 30일
  • 읽기4분
  • ConnectionInfoProvider API는 연결 별칭을 통해 연결 정보를 선택하는 메서드를 제공합니다.

    범위가 지정된 애플리케이션 또는 전역 범위 내에서 이 API를 사용할 수 있습니다. 범위가 지정된 스크립트에서는 sn_cc 네임스페이스 식별자를 사용합니다.

    이 함수는 지정된 연결 별칭으로 식별된 연결 정보를 검색합니다.

    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()

    연결 별칭을 통해 연결 정보를 선택합니다.

    표 1. 매개변수
    이름 유형 설명
    안 함

    ConnectionInfoProvider - getConnectionInfo(문자열 aliasID)

    현재 도메인에서 지정된 aliasID로 식별되는 ConnectionInfo 객체를 검색합니다.

    표 2. 매개변수
    이름 유형 설명
    별칭ID 문자열 연결 별칭의 Sys_id.
    표 3. 반환
    유형 설명
    연결 정보 연결에 대한 정보입니다.
    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(문자열 aliasID, 문자열 domainID)

    특정 도메인에 대해 지정된 aliasID로 식별되는 ConnectionInfo 객체를 검색합니다.

    표 4. 매개변수
    이름 유형 설명
    별칭ID 문자열 연결 별칭의 Sys_id.
    도메인 ID 문자열 도메인 또는 전역의 Sys_id입니다.
    표 5. 반환
    유형 설명
    연결 정보 연결 정보입니다.
    var provider = new sn_cc.ConnectionInfoProvider();
    
    // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");