DB2®DataSourceEnumerator.GetDataSources(string, string, string, string) Method

Returns a DataTable with information about the specified database server instance and databases on the instance.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
Public Overrides Function GetDataSources ( _
   strHost As String _
   strPort As String _
   strUID As String _
   strPWD As String _
) As DataTable
[C#]
public override DataTable GetDataSources (
   string strHost
   string strPort
   string strUID
   string strPWD
);
[C++]
public:
virtual DataTable^ GetDataSources (
   String* strHost,
   String* strPort,
   String* strUID,
   String* strPWD
) override
[JScript]
public override function GetDataSources (
   strHost : String,
   strPort : String,
   strUID : String,
   strPWD : String
) : DataTable

Parameters

strHost
This string can be the name of a system, an IPv4 address, or an IPv6 address. An IPv6 address must be the address only, without the port.
strPort
The port through which the database server can be contacted.
strUID
The user ID to access information from an instance of Informix®. No value is required for Db2® data servers.
strPWD
The password that is associated with the user ID.

Return value

A DataTable instance, which contains information about the visible database server instances and databases on those instances. The DataTable contains the following columns:
Table 1. Data source enumeration table columns
Column name Description
DatabaseAlias The alias by which the database is known.
DatabaseName The database name.
ServerName Name of the server. This column will contain a null value if the corresponding database exists on a local database server instance.
ServiceName Name of the service through which the database server accepts connections. This column will contain a null value if the corresponding database exists on a local database server instance.
InstanceName The database server instance name.
DatabaseLocation The location of the database (LOCAL or REMOTE).

Remarks

Using the GetDataSources method, you can use an IPv4 or IPv6 address to specify a host and identify database server instances and databases on those instances. To be visible, the remote database server instances must have a running database administration server (DAS), which is configured to respond to Search and Known Discovery requests. Database server instances without any databases are visible to the GetDataSources method.

Example

[C#] The following example demonstrates how to create a DB2DataSourceEnumerator instance (with the Instance field), and get a list of the visible data sources on 198.17.57.70:1526.
[C#]
    DB2DataSourceEnumerator dsenum = DB2DataSourceEnumerator.Instance;
    DataTable table = dsenum.GetDataSources("198.17.57.70", "1526", 
        "Admin04", "Admin04PWD");