6 Replies Latest reply: Jul 19, 2013 9:46 AM by KentKruckeberg RSS

    Instant Client/ODP.NET OracleConnection.Open fails with no error message

    867625
      Hello,

      I am using ODP.NET with Instant Client for one of my applications. I tested it on a few machines and it works fine except for one. The following exception is always thrown when an connection is opened (OracleConnection.Open):

      Oracle.DataAccess.Client.OracleException at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
      at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
      at Oracle.DataAccess.Client.OracleConnection.Open()

      The exception does not give any additional information (OracleException.Errors collection is empty).

      The application is compiled in Visual Studio 2010 in x86 mode and is targeting .NET 4.0 Framework. The following DLLs are referenced in the project and are copied to the output directory:

      oci.dll
      Version: 4.112.2.0
      Size: 1,015,808

      Oracle.DataAccess.dll
      Version: 11.2.0.1
      Size: 1,101,824

      orannzsbb11.dll
      Version: 11.0.0.1
      Size: 1,253,376

      oraociicus11.dll
      Version: 11.2.0.1
      Size: 35,414,016

      OraOps11w.dll
      Version: 2.112.2.0
      Size: 352,256

      All the DLLs were taken from ODAC 11.2 Release 3 (11.2.0.2.1) package (http://download.oracle.com/otn/other/ole-oo4o/ODAC112021Xcopy_32bit.zip)


      The machine where the application fails runs Windows XP x86. It has two Oracle Client installations (version 9.2 and 10.2). GAC contains the following Oracle.DataAccess assemblies:

      C:\WINDOWS\assembly\GAC\Oracle.DataAccess\1.102.2.20__89b483f429c47342\Oracle.DataAccess.dll
      C:\WINDOWS\assembly\GAC\Oracle.DataAccess\9.2.0.401__89b483f429c47342\Oracle.DataAccess.dll
      C:\WINDOWS\assembly\GAC_32\Oracle.DataAccess\2.102.2.20__89b483f429c47342\Oracle.DataAccess.dll


      Does anyone have any thoughts on this problem?

      Thanks

      Edited by: user5557094 on Jun 8, 2011 1:15 PM
        • 1. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
          gdarling - oracle
          Some more info please:

          Are you saying that OracleException::Message is null?

          You've indicated all the dlls were pulled from the odac xcopy bundle, but oraociius11.dll isnt in that zip. (IC lite should still work though). There is also no oci.dll with version 4.112.2.0 that I know of.

          Anyway, you deployed all of those dlls with the application, and they're found in the same directory the exe is in?

          Greg
          • 2. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
            867625
            Yes, OracleException.Message is empty. It is derived from OracleException.Errors collection, and the collection is null. I used dotPeek to look into OracleException implementation.

            Yes, you are right. I got oraociius11.dll from Oracle Instant Client Basic Light package (http://download.oracle.com/otn/nt/instantclient/112020/instantclient-basiclite-nt-11.2.0.2.0.zip).

            Sorry, I accidentally swapped info for Oracle.DataAccess.dll and oci.dll. The list should read:

            oci.dll
            Version: 11.2.0.1
            Size: 1,015,808

            Oracle.DataAccess.dll
            Version: 4.112.2.0
            Size: 1,101,824

            orannzsbb11.dll
            Version: 11.0.0.1
            Size: 1,253,376

            oraociicus11.dll
            Version: 11.2.0.1
            Size: 35,414,016

            OraOps11w.dll
            Version: 2.112.2.0
            Size: 352,256

            Yes, the executable and all the DLLs are in the same directory.
            • 3. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
              gdarling - oracle
              Hard to say what might be going on there with the limited info, to be able to tell whether its something like a dependency loading issue, or something like a 12154.
              If you use Process Explorer, do you see all of the dll's loaded? If not, and you use Process Monitor, do you see any load failures?
              If you use oraociei11.dll that came in the xcopy bundle rather than the IC Lite dll, do you see the same failure?
              What if you use the orannzsbb11.dll that comes in the ic lite zip instead of the odac zip?

              Greg
              • 4. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
                867625
                Thank you, Greg, for trying to help!

                In Process Explorer, I see oci.dll, oraociicus11.dll, OraOps11w.dll, and Oracle.DataAccess.dll loaded from the same folder where the executable was started from.

                My understanding is that oraociei11.dll is not required. Anyway, copying this DLL changed nothing. The application fails in exactly the same way with no additional information.

                Instant Client and ODAC Xcopy bundles contain exactly the same version of orannzsbb11.dll.

                Edited by: user5557094 on Jun 13, 2011 12:08 PM
                • 5. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
                  867625
                  It seems I have solved the problem for the machine where the application always failed. Somehow, the machine had value "NA" in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG registry key. The application started working after adding the following code:
                  Environment.SetEnvironmentVariable("NLS_LANG", "AMERICAN_AMERICA.UTF8"). Unfortunately, I could not make the application fail on other machines by setting the registry key to "NA", and this worries me. Also, are there any other environment settings I have to override in my application in order to make it "environment agnostic"?
                  • 6. Re: Instant Client/ODP.NET OracleConnection.Open fails with no error message
                    KentKruckeberg

                    Brilliant!  This solved the problem for me that I've been struggling with!  When I changed the registry value, code that had just not worked, began working.  I'll either fix the registry on the other systems that were plagued by this or use the code to set the env variable to remedy this.  Thanks a ton.