connect to oracle db with no odp.net installed

Posts   
 
    
virginia
User
Posts: 24
Joined: 29-Nov-2016
# Posted on: 09-Dec-2016 11:36:49   

It is possible with a .net application to connect to a Oracle db without installing any odp.net client ( just by having the necessary dlls in the same folder, method described here http://www.splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c/ ). We have been using this method with ora 11g dlls, .net framework 1.1 and llbl v1. We are now migrating to .net framework 4.5 and llbl v5. We prepared everything (llblgen project, .net sources) on a machine with odp.net installed and it works. When trying on a machine without odp.net installed, we have this error:

None of the factories in the list of 'Oracle.ManagedDataAccess.Client, Oracle.DataAccess.Client' were found. Please check machine.config and the .NET version your application is running on. at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.get_FactoryToUse() at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.InitializeEnumTypeCache() at SD.LLBLGen.Pro.DQE.Oracle.OracleSpecificCreator.SetDbProviderFactoryParameterData(List`1 dbProviderFactoryInvariantNamesWithEnumTypeNames, String dbProviderSpecificEnumTypePropertyName) at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..cctor()

And to further complicate the issue, I'm told it's not possible to modify the machine.config file on the clients' workstations smile

I know we could use the ODP.Net Managed driver, but it has some disadvantages (performance, not working with encryption etc) so we would prefer to use the same version as before. Do you think it's possible?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 09-Dec-2016 11:58:27   

You have to register the factory in your app/web.config file. The following is for firebird but you get the idea. Specify Oracle.DataAccess.Client as the 'name'. the 'type' is the fully qualified type name of the oracle factory. Copy the definition from a machine.config file to be sure simple_smile

The type defined as the factory type has to be in an assembly that's reachable by the application so inside e.g. the bin folder, so .NET will find/load the dll.

    <system.data>
        <DbProviderFactories>
            <add name="Firebird Client Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/>
        </DbProviderFactories>
    </system.data>
Frans Bouma | Lead developer LLBLGen Pro
virginia
User
Posts: 24
Joined: 29-Nov-2016
# Posted on: 12-Dec-2016 08:40:49   

Thanks a lot, after half a day of chasing versions smile I managed to make it work

sapul
User
Posts: 49
Joined: 11-Jan-2019
# Posted on: 16-Apr-2019 09:12:39   

Hello Frans, Year 2019 and your answer is still useful. Thank you. simple_smile