Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.2) Part Number E18754-01 |
|
|
PDF · Mobi · ePub |
An OracleDataSourceEnumerator
object allows applications to generically obtain a collection of data sources to connect to.
Supported Only in ADO.NET 2.0-Compliant ODP.NET
System.Object
System.DbDataSourceEnumerator
Oracle.DataAccess.Client.OracleDataSourceEnumerator
// C# public sealed class OracleDataSourceEnumerator : DbDataSourceEnumerator
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C# using System; using System.Data; using System.Data.Common; using Oracle.DataAccess.Client; class DataSourceEnumSample { static void Main() { string ProviderName = "Oracle.DataAccess.Client"; DbProviderFactory factory = DbProviderFactories.GetFactory(ProviderName); if (factory.CanCreateDataSourceEnumerator) { DbDataSourceEnumerator dsenum = factory.CreateDataSourceEnumerator(); DataTable dt = dsenum.GetDataSources(); // Print the first column/row entry in the DataTable Console.WriteLine(dt.Columns[0] + " : " + dt.Rows[0][0]); Console.WriteLine(dt.Columns[1] + " : " + dt.Rows[0][1]); Console.WriteLine(dt.Columns[2] + " : " + dt.Rows[0][2]); Console.WriteLine(dt.Columns[3] + " : " + dt.Rows[0][3]); Console.WriteLine(dt.Columns[4] + " : " + dt.Rows[0][4]); } else Console.Write("Data source enumeration is not supported by provider"); } }
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleDataSourceEnumerator
members are listed in the following tables.
OracleDataSourceEnumerator Public Methods
OracleDataSourceEnumerator
Public Methods are listed in Table 7-10.
Table 7-10 OracleDataSourceEnumerator Method
Method | Description |
---|---|
Returns a |
The OracleDataSourceEnumerator
static method is listed in Table 7-11.
Table 7-11 OracleDataSourceEnumerator Method
Method | Description |
---|---|
Returns a |
See Also:
This method returns a DataTable
object with information on all the TNS alias entries in the tnsnames.ora
file.
// C# public override DataTable GetDataSources();
A DataTable
object.
This method returns a DataTable
object for each TNS Alias entry that exists in the tnsnames.ora
file.
If the tnsnames.ora
file is not found, then the returned DataTable
object is empty.
The following columns are returned for each row, but only the InstanceName
column is populated.
InstanceName
(type: System.String
)
ServerName
(type: System.String
)
ServiceName
(type: System.String
)
Protocol
(type: System.String
)
Port
(type: System.String
)