Question

I know that I can use the following code to enumerate all SQL Server instances on network:

 SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
 DataTable table = instance.GetDataSources(); 

But I was wondering if there was a way of doing this for Oracle Instances as well. Oracle's ODP.NET (Oracle.DataAccess.Client) supports DataSourceEnuerator, apparently System.Data.OracleClient doesn't though. However the DataSourceEnumerator only enumerates the entries that are found in the local TNSNames.ora file.

Was it helpful?

Solution

What you're seeing is due to the fundamental difference in how SQL Server and Oracle databases announce themselves. SQL Server (at least 2000 and 2005) use the SQL Browser Service to advertise databases available on the network. Oracle, on the other hand, requires you to explicitly enumerate instances available using TNS entries.

This is an instance of When in Rome, where Oracle is attempting to follow the API. Unfortunately, without custom code you won't be able to replicate the SQL Server behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top