8 Replies Latest reply: Sep 11, 2012 10:25 AM by user6480755 RSS

    ODP.NET4 required .NET2.0?

    954012
      OS : Windows XP
      .NET : .NET 4 Client Profile only.(not installed .NET2/3.5)

      ODAC 11.2.0.3.0 XCopy download. install.bat odp.net4 ~ ~ true

      run my app, OracleConnection creating Type Initializer Error.

      but my app succeed, after the .NET 3.5SP1 installation.

      OraOps11w.dll version 2.112.3.0.
      Oracle.DataAccess.dll version 4.112.3.0

      Because the version of the OraOps11w.dll is different?
        • 1. Re: ODP.NET4 required .NET2.0?
          Alex.Keh .Product.Manager-Oracle
          ODP.NET 2 is required for .NET Framework 2.x and 3.x. ODP.NET 4 is required for .NET Framework 4.x and above.

          Your app is probably using ODP.NET 2.x and the ODP.NET 2.x dependent DLLs. The app wouldn't work if it was using Oracle.DataAccess.dll 4.x with 2.x dependent DLLs.
          • 2. Re: ODP.NET4 required .NET2.0?
            954012
            hi Alex.

            reply thx.

            xp env is installed odp.net4 only.(don't install odp.net2)

            minimum code run result.
            ----------------
            mscorelib, Version=4.0.0.0, ...
            Oracle.DataAccess, Version=4.112.3.0, ...
            'Oracle.DataAccess.Client.OracleConnection' type iniitalize error ....
            ----------------
            but after installing the.NET3.5SP1 if Windows Update,not throw exception.

            [minimum code]
            <pre>
            using System;
            using Oracle.DataAccess.Client;

            class Program {
            static void Main(string[] args) {
            try {
            Console.WriteLine(typeof(string).Assembly.FullName);
            Console.WriteLine(typeof(OracleConnection).Assembly.FullName);
            var connStr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=service name)));User Id=user;Password=pass;";
            using (var conn = new OracleConnection(connStr))
            using (var cmd = new OracleCommand(@"select SYSDATE from dual", conn)) {
            conn.Open();
            Console.WriteLine(cmd.ExecuteScalar());
            }
            }
            catch (Exception e) {
            Console.WriteLine(e.Message);
            Console.WriteLine(e.StackTrace);
            }
            Console.ReadKey();
            }
            }
            </pre>
            • 3. Re: ODP.NET4 required .NET2.0?
              Alex.Keh .Product.Manager-Oracle
              .NET Framework 3.5 must use ODP.NET for .NET 2. It can't use ODP.NET for .NET 4, which is is why you have an exception.
              • 4. Re: ODP.NET4 required .NET2.0?
                954012
                I going to use .NET 4 Client Profile, Oracle.DataAccess.dll (ver 4.112.3).but had been using ODP.NET2 within do not know?
                • 5. Re: ODP.NET4 required .NET2.0?
                  user6480755
                  Hi Alex,

                  i have similar issue.
                  My Xp production machine have installed onlt .net 4 (extended) and i develop application on dev machine with Oracle.DataAccess.Dll 4.112.3.0.
                  But i have same exception.
                  If i install .net 3.5 it work fine.

                  You have any idea?

                  Thanks.
                  • 6. Re: ODP.NET4 required .NET2.0?
                    Alex.Keh .Product.Manager-Oracle
                    We've seen this type of issue before if a machine is missing Visual C++ 2005 SP 1 redistributable package, which you can download here for 32-bit.
                    http://www.microsoft.com/en-us/download/details.aspx?id=5638

                    You're not missing .NET 3.5 per se. Rather, I believe .NET 3.5 includes this redistributable.

                    ODP.NET consists of managed and unmanaged code. The unmanaged code relies on that specific version of the VC++ redistributable package.
                    • 7. Re: ODP.NET4 required .NET2.0?
                      954012
                      hi. Alex.

                      [Environment]
                      ・Windows XP
                      ・.NET 4 Client Profile
                      ・ODP.NET 4
                      ・VC++ redistributable package

                      Running my app!

                      thanks.
                      • 8. Re: ODP.NET4 required .NET2.0?
                        user6480755
                        Hi Alex.

                        Thanks for your response.
                        Now i try with c++ redistributable package.

                        Many thanks!

                        Edited by: user6480755 on Sep 11, 2012 5:25 PM