3 Replies Latest reply on Mar 1, 2018 6:11 AM by Gaz in Oz

    GetDataSources()

    3305994

      Hello!

      I have 2 Oracle Server 12g on my local network.

      I use the GetDataSources method to query all instances of the Oracle Server.

      The method only returns the instances of a database server!

      What could be the cause?

      factory.CreateDataSourceEnumerator (); // Initalize DB-Source enumeration
                       dt = dsenum.GetDataSources ();


      ================================================== ===========

       

      /// <summary>
      /// Retrieves the Oracle instances on the local network.
      /// </ summary>
      /// <returns> Table of found Oracle instances. </ returns>
      public static DataTable ReadOracleInstance ()
      {
           DataTable dt = new DataTable ();

           string ProviderName = "Oracle.DataAccess.Client";
        
           System.Data.Common.DbProviderFactory factory = System.Data.Common.DbProviderFactories.GetFactory (ProviderName);

           if (factory.CanCreateDataSourceEnumerator) // Can the DB-Source be retrieved from the DB provider?
           {
               System.Data.Common.DbDataSourceEnumerator dsenum = factory.CreateDataSourceEnumerator (); // Initalize DB-Source enumeration
               dt = dsenum.GetDataSources ();
           }
           else throw new Exception ("Data source enumeration is not supported by provider");

           return dt; // return the (filled) DataTable.
      }