ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data Namespace / AuthenticationMode Enumeration
Example Example

In This Topic
    AuthenticationMode Enumeration
    In This Topic
    Specifies the method used to authorize the users login credentials.
    Syntax
    Members
    MemberDescription
    DBMS Database user authentication (a database user name and password required).
    OSA Operating system authentication (No user name or password need be provided, they are taken from the OS).
    Example
    Opening an Enterprise Geodatabase using connection properties
    public async Task OpenEnterpriseGeodatabase()
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
      {
        // Opening a Non-Versioned SQL Server instance.
        DatabaseConnectionProperties connectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
        {
          AuthenticationMode = AuthenticationMode.DBMS,
    
          // Where testMachine is the machine where the instance is running and testInstance is the name of the SqlServer instance.
          Instance = @"testMachine\testInstance",
    
          // Provided that a database called LocalGovernment has been created on the testInstance and geodatabase has been enabled on the database.
          Database = "LocalGovernment",
    
          // Provided that a login called gdb has been created and corresponding schema has been created with the required permissions.
          User = "gdb",
          Password = "password",
          Version = "dbo.DEFAULT"
        };
    
        using (Geodatabase geodatabase = new Geodatabase(connectionProperties))
        {
          // Use the geodatabase
        }
      });
    }
    
    Create Default QueryDescription for a Database table and obtain the ArcGIS.Core.Data.Table for the QueryDescription
    public async Task DefaultQueryDescription()
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
      {
        DatabaseConnectionProperties databaseConnectionProperties = 
        new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
        {
          AuthenticationMode = AuthenticationMode.DBMS,
          Instance = "instance",
          Database = "database",
          User = "user",
          Password = "password"
        };
    
        using (Database database = new Database(databaseConnectionProperties))
        {
          QueryDescription queryDescription = database.GetQueryDescription("CUSTOMERS");
    
          using (Table table = database.OpenTable(queryDescription))
          {
            //use table
          }
        }
      });
    }
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.Data.AuthenticationMode

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also