oracle versions and machine.config

Posts   
 
    
virginia
User
Posts: 29
Joined: 29-Nov-2016
# Posted on: 07-Sep-2020 09:56:24   

We are using a .net application to connect to a Oracle db without installing any odp.net client ( just by having the necessary ora11g dlls in the same folder, method described here http://www.splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c/ ).

And using this in the app.config file

<configSections>
    <section name="oracle.dataaccess.client" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>

 <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.DataAccess.Client" />
      <add name="Oracle Data Provider for .NET" description="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>
  <oracle.dataaccess.client>
    <settings>
      <add name="DllPath" value="R:\astech.office\trunk\bin\x86\Debug" />
      <add name="bool" value="edmmapping number(1,0)" />
      <add name="byte" value="edmmapping number(3,0)" />
      <add name="int16" value="edmmapping number(5,0)" />
      <add name="int32" value="edmmapping number(10,0)" />
      <add name="int64" value="edmmapping number(19,0)" />
      <add name="int16" value="edmmapping number(38,0)" />
      <add name="int32" value="edmmapping number(38,0)" />
      <add name="int64" value="edmmapping number(38,0)" />
    </settings>
  </oracle.dataaccess.client>

On one client's machine, after intalling ODAC 12.1, there's this error:

Impossible d'effectuer un cast d'un objet de type 'Oracle.DataAccess.Client.OracleParameter' en type 'Oracle.ManagedDataAccess.Client.OracleParameter'. à Oracle.ManagedDataAccess.Client.OracleParameterCollection.AddRange(Array paramArray) à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateStoredProcedureCallCommand(String storedProcedureToCall, DbParameter[] parameters) à SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CallRetrievalStoredProcedure(String storedProcedureToCall, DbParameter[] parameters, DataSet dataSetToFill)

If they "replace the C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.Config file with one from another computer" (that's what they said) the error disappears.

It's obvious the runtime load the wrong factory, but why? I tried installing odac on other machines, and there's no problem, even if the machie.config file is the same. Do you have any suggestions on how to investigate this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39761
Joined: 17-Aug-2003
# Posted on: 07-Sep-2020 11:07:09   

In the application code, create a new instance of the OracleSpecificCreator class (this is part of the DQE assembly, so you have to add a reference to that), then retrieve the FactoryToUse property to get the factory that's used.

You can then check the .GetType().Assembly.Location value to see where the assembly is loaded from.

Not sure which llblgen pro version you're using, but consider using the managed provider from Oracle over this dll mess as the oracle cli has to be in the right folder (the 'oracle home') according to the active path variable of the executing user.

Frans Bouma | Lead developer LLBLGen Pro
virginia
User
Posts: 29
Joined: 29-Nov-2016
# Posted on: 10-Sep-2020 14:50:18   

Thanks, will try