ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Data Namespace / Geodatabase Class / Geodatabase Constructor / Geodatabase Constructor(DatabaseConnectionFile)
A physical database connection file that ends with a .sde extension.
Example

In This Topic
    Geodatabase Constructor(DatabaseConnectionFile)
    In This Topic
    Opens an enterprise geodatabase with the specified connection file. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    databaseConnectionFile
    A physical database connection file that ends with a .sde extension.
    Exceptions
    ExceptionDescription
    The information used to connect to the geodatabase is invalid.
    A geodatabase-related exception has occurred.
    This object must be created within the lambda or delegate passed to QueuedTask.Run, or on a compatible STA thread.
    Example
    Getting Database Connection Properties from a Connection File
    {
      DatabaseConnectionFile connectionFile =
        new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"));
      DatabaseConnectionProperties connectionProperties =
        DatabaseClient.GetDatabaseConnectionProperties(connectionFile);
    
      // Now you could, for example, change the user name and password in the connection properties prior to use them to open a geodatabase
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also