ConnectionInfoProvider - Scoped, Global

Use ConnectionInfoProvider API 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 = connection.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()

Use ConnectionInfoProvider() to select connection information through the connection alias.

Table 1. Parameters
Name Type Description
None

Scoped ConnectionInfoProvider - getConnectionInfo(String aliasID)

This function retrieves a ConnectionInfo object identified by the given aliasID in the current domain.

Table 2. Parameters
Name Type Description
aliasID String The sys_id of a connection alias.
Table 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");

Scoped ConnectionInfoProvider - getConnectionInfoByDomain(String aliasID, String domainID)

This function retrieves a ConnectionInfo object identified by the given aliasID for a specific domain.

Table 4. Parameters
Name Type Description
aliasID String The sys_id of a connection alias.
domainID String The sys_id of a domain or global.
Table 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");