An OracleDataSourceEnumerator
object allows applications to generically obtain a collection of data sources to connect to.
System.Object
System.DbDataSourceEnumerator
Oracle.DataAccess.Client.OracleDataSourceEnumerator
// C# public sealed class OracleDataSourceEnumerator : DbDataSourceEnumerator
Provider | ODP.NET, Unmanaged Driver | ODP.NET, Managed Driver |
Assembly | Oracle.DataAccess.dll |
Oracle.ManagedDataAccess.dll |
Namespace | Oracle.DataAccess.Client |
Oracle.ManagedDataAccess.Client |
.NET Framework | 3.5, 4.0, 4.5 | 4.0, 4.5 |
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"); } }
See Also:
OracleDataSourceEnumerator
members are listed in the following tables.
OracleDataSourceEnumerator Constructor
OracleDataSourceEnumerator
Public Methods are listed in Table 6-60.
Table 6-60 OracleDataSourceEnumerator Method
Method | Description |
---|---|
Instantiates a new instance of the OracleDataSourceEnumerator class |
See Also:
OracleDataSourceEnumerator Public Methods
OracleDataSourceEnumerator
Public Methods are listed in Table 6-61.
OracleDataSourceEnumerator
constructor creates new instances of an OracleDataSourceEnumerator
class.
// C# public OracleDataSourceEnumerator();
The OracleDataSourceEnumerator
static method is listed in Table 6-62.
Table 6-62 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 and entries retrieved from the LDAP servers configured in ldap.ora
if LDAP naming is enabled.
// 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 and each entry retrieved from the LDAP servers. If a tnsnames.ora
file is not found and LDAP Naming is not configured, then the returned DataTable
object will be empty.
When Oracle Internet Directory (OID) is used for the TNS naming repository, there is a limit of 1000 TNS entries retrieved.
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
)
If the TNS and/or LDAP information changes for existing pooled connections, then calling GetDataSources
will not return these changes unless the pools have been cleared.