Archive for June, 2018

Unable to find the requested .Net Framework Data Provider. It may not be installed.

While moving a web application to a new web server, an application which used Entity Framework returned this message when loading:

ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.

   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +959971

   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +26

 

And this message also appeared a bit lower on the yellow screen of death:

ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.

 

The problem was with the DbProviderFactories elements in the machine.config file – it didn’t have the correct drivers installed. To fix it, I opened Notepad (Visual Studio wasn’t installed on the server) as an administrator because the file wouldn’t let me save it otherwise. I scrolled down the <system.data> section, which initially looked like this:

<system.data>

<DbProviderFactories />

</system.data>

 

I replaced it with the section below which I pulled from my local machine. I have left in all the libraries in case that helps, though in our environment, we didn’t use the SQL Server CE drivers:

<system.data>

             <DbProviderFactories>

<add name=”ODP.NET, Managed Driver” invariant=”Oracle.ManagedDataAccess.Client” description=”Oracle Data Provider for .NET, Managed Driver” type=”Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342″/>

<add name=”ODP.NET, Unmanaged Driver” invariant=”Oracle.DataAccess.Client” description=”Oracle Data Provider for .NET, Unmanaged Driver” type=”Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342″/>

<add name=”Microsoft SQL Server Compact Data Provider 4.0″ invariant=”System.Data.SqlServerCe.4.0″ description=”.NET Framework Data Provider for Microsoft SQL Server Compact” type=”System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91″/>

<add name=”Microsoft SQL Server Compact Data Provider” invariant=”System.Data.SqlServerCe.3.5″ description=”.NET Framework Data Provider for Microsoft SQL Server Compact” type=”System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91″/>

               </DbProviderFactories>

</system.data>

Advertisements

Leave a comment

ORA-00918: column ambiguously defined with CASE column

I had an Oracle query that was returning the error “ORA-00918: column ambiguously defined” when I tried to run it:

SELECT * FROM ( 
  SELECT ID, CASE
    WHEN something THEN something else
    ELSE yet more
  END CASE
FROM ScottsTable
UNION ALL
  SELECT ID, CASE 
    WHEN something THEN something else
    ELSE yet more
  END CASE
FROM ScottsTableHistory
) ORDER BY 1 ASC, 2;

The problem was originating in the first query’s CASE statement. I needed to put an alias on the first CASE statement to avoid the naming duplication that was causing Oracle to hate me. Here is the final, modified query:

SELECT * FROM ( 
  SELECT ID, CASE
    WHEN something THEN something else
    ELSE yet more
  END "MY COLUMN"
FROM ScottsTable
UNION ALL
    SELECT ID, CASE 
    WHEN something THEN something else
  ELSE yet more
END CASE
FROM ScottsTableHistory
) ORDER BY 1 ASC, 2;

Leave a comment