Retrieves a list of all existing Touchstone® SQL
Data Servers that are registered with the Touchstone application and available to the current
Project.
Use the GetDataServers()
method to find out the name and Touchstone-generated Data Server Sequential Identifier (SID) of each Data Server that is registered with the Touchstone application. This method also returns the file path to the server (MDF file path) and the path to the log file of actions that the server recently executed (LDF file path).
Parameters
- request
- Contains a GetDataServersRequest that identifies the Business Unit SID and SQL Instance SID associated with the list of Data Servers that you want to retrieve.
Return Value
A
GetDataServersResponse containing a
list of Data Servers that are registered with the Touchstone application and available to the current Project.
The following example shows how to retrieve a list of all Touchstone Data Servers that are registered with the Touchstone application and available to the current Project using the
GetDataServers()
method:
using System;
using AIR.Services.Common.Data;
using AIR.Services.DataSourceManagement.Api;
using AIR.Services.DataSourceManagement.Data;
class SnippetGetDataServersRequest
{
private static void GetDataServers(int businessUnitSid, int sqlInstanceSid)
{
DataSourceManagementServiceClient dsClient = new DataSourceManagementServiceClient();
GetDataServersRequest request = new GetDataServersRequest();
request.BusinessUnitSid = businessUnitSid;
request.SqlInstanceSid = sqlInstanceSid;
GetDataServersResponse response = dsClient.GetDataServers(request);
if (response.Status.Code == StatusCode.Success)
{
foreach (DataServer ds in response.DataServers)
{
Console.WriteLine("------------------------------------------------------------");
Console.WriteLine("SID: " + ds.Sid);
Console.WriteLine("Name: " + ds.Name);
Console.WriteLine("Default MDF File Path: " + ds.DefaultMdfFilePath);
Console.WriteLine("Default LDF File Path: " + ds.DefaultLdfFilePath);
}
}
}
}
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2