DB2®DataSourceEnumerator.GetDataSources () Method
Returns a DataTable with information about all the visible database server instances and databases on those instances.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Overrides Function GetDataSources As DataTable
[C#]
public override DataTable GetDataSources ()
[C++]
public:
virtual DataTable^ GetDataSources () override
[JScript]
public override function GetDataSources () : DataTable
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:
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 find any visible Db2® family database
server instances and databases on those instances. The GetDataSources method
works through the IBM® Data Server Provider for .NET and is
able to see the following information:
- all databases cataloged on the local instance. In the case where there are multiple local Db2 instances, GetDataSources behavior is undefined.
- all visible remote database server instances and their databases. In order 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.
Example
[C#] The following example demonstrates how to create a DB2DataSourceEnumerator instance (with the Instance field), and get a list of all the visible Db2 family data sources (with the GetDataSources method).
[C#]
DB2DataSourceEnumerator dsenum = DB2DataSourceEnumerator.Instance;
DataTable table = dsenum.GetDataSources();