---
sourceDocument: Référence de l’API Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence de l’API Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ConnectionInfoProvider : champ d'application, global

# ConnectionInfoProvider : champ d'application, global {#ariaid-title1}

* Rversion finale: Xanadu
* 
* Mis à jour 1 août 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute de lecture

L'API ConnectionInfoProvider fournit des méthodes pour sélectionner les informations de connexion via l'alias de connexion.

Vous pouvez utiliser cette API dans les applications incluses dans le périmètre ou dans le périmètre global. Dans les scripts inclus dans le champ d'application, utilisez l'identificateur `d'espace` de noms sn_cc.

Cette fonction récupère les informations de connexion identifiées par l'alias de connexion donné.  

    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() {#ariaid-title2}

Sélectionne les informations de connexion via l'alias de connexion.
{#CIP-get-connection-infoprovider__table_afx_pp2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucun |   |   |
[Tableau 1. Paramètres]

{#CIP-get-connection-infoprovider__table_afx_pp2_qbb}

## ConnectionInfoProvider : getConnectionInfo (aliasID de chaîne) {#ariaid-title3}

Récupère un objet ConnectionInfo identifié par l'aliasID donné dans le domaine actuel.
{#CIP-getConnectionInfo_S__table_xxn_xq2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| aliasID | Chaîne | Sys_id d'un alias de connexion. |
[Tableau 2. Paramètres]

{#CIP-getConnectionInfo_S__table_xxn_xq2_qbb} {#CIP-getConnectionInfo_S__table_yxn_xq2_qbb__entry__2}

| Type | Description |
|-|-|
| Infoconnexion | Informations sur la connexion. |
[Tableau 3. Renvoie]

{#CIP-getConnectionInfo_S__table_yxn_xq2_qbb}  

    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) {#ariaid-title4}

Récupère un objet ConnectionInfo identifié par l'aliasID donné pour un domaine spécifique.
{#CIP-getConnectionInfoByDomain_S_S__table_xxn_xq2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| aliasID | Chaîne | Sys_id d'un alias de connexion. |
| ID de domaine | Chaîne | Sys_id d'un domaine ou <kbd class="ph userinput">global</kbd>. |
[Tableau 4. Paramètres]

{#CIP-getConnectionInfoByDomain_S_S__table_xxn_xq2_qbb} {#CIP-getConnectionInfoByDomain_S_S__table_yxn_xq2_qbb__entry__2}

| Type | Description |
|-|-|
| Infoconnexion | Informations de connexion. |
[Tableau 5. Renvoie]

{#CIP-getConnectionInfoByDomain_S_S__table_yxn_xq2_qbb}  

    var provider = new sn_cc.ConnectionInfoProvider();

    // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");


