7 Replies Latest reply on Mar 31, 2012 7:54 AM by B_M_A

    The type initializer for 'Oracle.DataAccess.Client.OracleConnection'

      Hi All,

      I am facing a error while doing asp.net web configuration.I am getting the following error

      System.typeInitializationException{"The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."}
      Inner Exception{"The provider is not compatible with the version of Oracle client"}

      Installed following on my system
      Visual Studio 2008
      oracle Database 10g Release
      Installed Oracle 11g Oracle Data Access Components (ODAC) with Oracle Developer Tools for Visual Studio version

      Can Any one help me out in this


        • 1. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
          gdarling - oracle
          Which version of ODP is your app actually using?

          10201 ODP relies on your PATH environment variable. If you install 10201 first, then add an 11g install, the 11g install will come before the 102 install in your path. If your app is using 10201 and that's the situation, either putting the 10201 home to the top in the Oracle Universal Installer, or manually adjusting your PATH so that the 10201 OH\BIN comes before 11g should resolve the issue.

          Hope it helps,

          Edited by: gdarling on Mar 27, 2012 11:31 AM

          Also, you're actually using the ASP.NET providers then, as opposed to simply coding an ODP.NET app? If so, what version of ODP.NET does the app itself use?
          I'm not sure whether the ASP.NET stuff runs in the same process space as the app itself, but I suspect there may be a conflict trying to load multiple versions into the same process.
          • 2. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
            Hi Greg,

            Thanks for the reply.

            The following Version of odp.net are available in the refernce of the applocation

   from the following location E:\app\100468\product\11.1.0\client_1\odp.net\bin\2.x\Oracle.DataAccess.dll

   from location F:\oracle\product\10.2.0\db_2\BIN\Oracle.DataAccess.dll

            The following Version of asp.net are available in the refernce of the applocation

   from location E:\app\100468\product\11.1.0\client_1\ASP.NET\bin\2.x\Oracle.Web.dll

            Thanks and Regards

            • 3. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
              gdarling - oracle
              I didn't think you could add two references to different versions of the same dll. Anyway, I'd try removing the 10.2 reference so the app only uses 11106.20 instead, and see if that helps.

              1 person found this helpful
              • 4. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
                Hi Greg,

                As u said removed the multiple versions and with a single version getting follwing error when running the application.

                Parser Error Message: Could not load file or assembly 'Oracle.Web, Version=, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

                Source Error:

                Line 176: <healthMonitoring>
                Line 177: <providers>
                Line 178: <add name="OracleWebEventProvider" type="Oracle.Web.Management.OracleWebEventProvider, Oracle.Web, Version=, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" buffer="true" bufferMode="OracleNotification" />
                Line 179: </providers>
                Line 180: </healthMonitoring>

                Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 178
                • 6. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
                  gdarling - oracle
                  I'm not sure if "na" means "disregard, I figured it out", but the error you're getting now is that it's looking for *11.2* ODP. Did you previously have 11.2 installed? If so, and you removed it, did you also remove the policy files?

                  Was the app compiled with 11.2?

                  The best thing to do at this point may be to completely remove the oracle client software, and "start over" clean, and install only a single Oracle home, but it kind of looks like you also have a 10.2 database on that box?

                  Note also that ODP was only 1.x, and as of and newer (ie, 11.2) ODP.NET, there is no more 1.x.

                  You might want to open a SR with support and we'll give you a hand getting it all sorted out.

                  • 7. Re: The type initializer for 'Oracle.DataAccess.Client.OracleConnection'
                    Hi Greg,

                    Thanks a lot,It was helpfull to resolve the issue