ArcObjects Library Reference (DataSourcesGDB)  

IDataServerManager Interface

Provides access to the DataServerManager object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use this interface to initialize and connect to a Database Server.  Once connected, depending on your permissions level, you can perform administration tasks, get properties of the server and create and open geodatabases on the server.

Members

Description
Read-only property AvailableMemory The total available memory (MB).
Method Connect Connects to an initialized Data Server.
Method CreateConnectionFile Create a Data Server connection file.
Read-only property DataServerClass The server class.
Read-only property DataServerType The type of data server.
Method Disconnect Disconnects from the Data Server.
Method InitFromFile Initializes a saved connection to the GIS Data Server.
Read-only property IsConnected Indicates whether the server is connected or not.
Read-only property ProductName The product name.
Read-only property ProductVersion The product version.
Read/write property ServerName The data server name.

CoClasses that implement IDataServerManager

CoClasses and Classes Description
DataServerManager Object to administer a Data Server.
[C#]

The IDataServerManager interface allows you perform general operations on a Database Server, such as Connect or Disconnect, etc.  To connect to a Database Server, you must first initialize the DataServerManager by setting the ServerName property or the InitFromFile method:

dataserverManager.ServerName = "minnie\\sqlexpress";
dataserverManager.InitFromFile ("C:\\Documents and Settings\\bobm\\Application Data\\ESRI\\ArcCatalog\\minnie_SQLEXPRESS.GDS");

Operations performed on the server service itself, such as stopping and starting the server, must be performed will disconnected from the server.

// The following code example demonstrates how to establish a connection to a database server in order
// to open an existing workspace\geodatabase
public void esriDataSourcesGDB__IDataServerManager()
{
    // Create a Data Server Manager object
    IDataServerManager dataserverManager = new DataServerManagerClass();
    dataserverManager.ServerName = "minnie\\sqlexpress";

    dataserverManager.Connect();

    // Create a new workspace name object for the geodatabase we want to open
    IDataServerManagerAdmin dataservermanagerAdmin = (IDataServerManagerAdmin)dataserverManager;
    IWorkspaceName workspaceName = dataservermanagerAdmin.CreateWorkspaceName ("Landbase", "VERSION", "dbo.DEFAULT");

    // Open the workspace
    IName name = (IName)workspaceName;
    IWorkspace workspace = (IWorkspace)name.Open();
}

.NET Related Topics

Connecting to a geodatabase | Creating geodatabases | DataSourcesGDB |