locked
Make app 32 bit / 64 bit oracle dataaccess independent RRS feed

  • Question

  • User-725020093 posted

    Hi ,

      I am using odp.net in my asp.net app. I have deployed the app through ms build. I don't want the vs 2010 to copy the dependent dlls into the deployment msi. The build process worked only when I overwrote the 64 bit dll with 32 bit Oracle.DataAccess.dll.  It was throwing type mismatch with AMD 64x version error. I want it to take the reference from the GAC ( when iis is set to 32 bit it should take 32 bit reference when 64 bit is set it should take 64 bit - both are installed in the server where it is being deployed as well as the system where we create the msi). 32 bit mode works fine and not 64 bit is there any setting to make it work for both. I have not specified any version in the proj reference section and set copy local "false".

    Thanks

    Saturday, November 28, 2015 7:52 PM

All replies

  • User269602965 posted

    The more recently introduced Oracle 12c R4 MANAGED Oracle Data Access driver has three advantages.  32-bit and 64-bit aware in the same driver DLL, no dependence on GAC so can be ported with app using LOCAL reference, and has built in Client that works with Oracle 12c, 11g, and 10g, no need to install Oracle Client on the app server.  There are some changes required in the application configuration, such as making the app aware of the tnsnames.ora file location, and new imports statement, but other than that .NET coding is the same.  The disadvantages are: it will not work in FIPS-140 ENABLED environment for Oracle 10g and 11g, and being relatively new, some less often used features may be buggy or not yet available.  However, I have used it with console apps, WPF apps, and ASP.NET apps.  Portability of code and embedded client are very useful to me.  Good bye unmanaged driver and GAC headaches.

    ODP.NET_Managed_ODAC12cR4.zip - 2.57 MB (2,696,630 bytes)  This download contains ODP.NET, Managed Driver xcopy only. Installation Instructions are included within the zip file. 

    http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

    Sunday, November 29, 2015 3:55 AM
  • User-725020093 posted

    Hi thanks,

      Is there a way to make the app work in the existing unmanaged odp.net as there are time constraints for delivering the project. what are the changes in the code that needs to be done to migrate from unmanaged to managed odp.Net.

    Please help me

    Tuesday, December 1, 2015 6:37 PM
  • User1289604957 posted

    Hi,

    Here are différences between the ODP.NET Managed Driver and Unmanaged Driver : http://docs.oracle.com/database/121/ODPNT/intro004.htm#ODPNT8146

    So if you use the unmanaged driver you need to select 32 bits for your solution configuration and compile all your class Library to 32 bits. It's also the same for 64 bit architecture.

    It means you shouldn't use AnyCPU configuration. On the contrary, the managed driver is independant and AnyCPU configuration works fine like a charm.

    Hope this could help you!

    Best,

    Maher

    Wednesday, December 2, 2015 2:38 PM
  • User269602965 posted

    The changes are minor

    There is some set up to tell the app about the managed driver config and location of the tnsnames.ora file

    and the IMPORTS statement is slightly different

    but the CODE within the project is the same managed and unmanaged drivers

    Wednesday, December 2, 2015 9:42 PM
  • User269602965 posted

    How I set up my web.config for MANAGED DRIVEr

    <configuration>
      <configSections>
        <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />
      </configSections>
      <connectionStrings>
        <add name="OraConStr" connectionString="Data Source={INSTANCENAME};Persist Security Info=True;User Id={USERNAME};Password={PASSWORD}" providerName="Oracle.ManagedDataAccess.Client" />
      </connectionStrings>
      <oracle.manageddataaccess.client>
        <version number="*">
          <settings>
            <setting name="tns_admin" value="c:\ora\db11g201\network\admin" />
          </settings>
        </version>
      </oracle.manageddataaccess.client>
      <system.data>
        <DbProviderFactories>
          <remove invariant="Oracle.DataAccess.Client" />
          <remove invariant="Oracle.ManagedDataAccess.Client" />
          <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" />
        </DbProviderFactories>
      </system.data>
    ...
    then rest of your web.config
    
    You can add the managed driver namespaces
    
            <add namespace="Oracle.ManagedDataAccess.Client" />
            <add namespace="Oracle.ManagedDataAccess.Types" />
    
    which are the same as your USING or IMPORTS statements in code behind form
    
    IMPORTS Oracle.ManagedDataAccess.Client
    IMPORTS Oracle.ManagedDataAccess.Types
    
    Put the oracle managed driver into your app /BIN folder and make a local reference..
    bye bye GAC unmanaged driver
    
    Also notice above the path is set to the tnsnames.ora file to provide your MANAGED DRIVER client with the connection information it needs using tnsnames.
    
    You can put the tnsnames.ora in the bin folder too and make a reference to it there.

    Friday, December 4, 2015 1:09 AM
  • User-725020093 posted

    Hi ,

      I was not able to connect the db using Managed oracle drivers, thouh I am not getting any build errors. Do I have to use Oracle.ManagedDataAccessDTC.dll in the reference. Iam developing an asp.net website application and using this dll in the dataaccess layer of the app.

    Thanks

    Saturday, December 5, 2015 6:16 AM
  • User269602965 posted

     Oracle.ManagedDataAccessDTC.dll

    No this is only used for TRANSACTIONAL calls.

    Not required for more routine SELECT, UPDATE, INSERT, DELETE and calls to PL/SQL procedure operations.

    However if Oracle.ManagedDataAccessDTC.dll is required, I believe it is 32-bit and 64-bit specific, so you have to use the correct one.

    Yes,

    It took me a while to figure out the configurations that worked, but then it worked fine.

    Did you read the Managed Driver documentation yet?  If not, you need to do that.

    Monday, December 7, 2015 12:00 AM
  • User269602965 posted

    If your environment has security policy for FIPS-140 enabled and your database is 10g or 11g, the managed driver will not work.

    Monday, December 7, 2015 12:03 AM