Can not find Oracle home / Points of Confusion

Can not find Oracle home / Points of Confusion

Postby CadeThacker » Tue 05 Apr 2011 00:25

Hello Devart folks,
I'm stuck and really need some help. If these questions sound basic to you all please be gentle, because as somebody brand new to the entire stack (MVC3 .NET 4.0, EF4, Oracle 10.2, Devart, IIS7) this seems very tricky.

The problem. When I execute my application I get the following:

System.Data.EntityException: The underlying provider failed on Open. ---> System.InvalidOperationException: Can not find Oracle home.

So, here are the steps I took to investigate. Feel free to give me a Harder, Better, Faster, Stronger(tm) way to work this:

To help narrow down the variables, I created a test MVC app that did nothing but query the Oracle database via EF on my laptop and report the number of rows back. Worked great there.

I'm now trying to deploy this test app to the development server. [edit: the development server and my laptop both connect to the same Oracle database, fyi]

So here are the steps I took on the server (Windows 2008). Just to be clear, the DBA has already gone home, so this may be an Oracle issue, but that being said, I still have tons of questions about DevArt, and hopefully you all can tell me if any of the steps below are not required or give me clarification.

1) I did a "minimal" install of Devart installer (dcoracle610pro.exe) which seemed to put Devart.Data and Devart.Data.Oracle into GAC.

2) I found my inventory.xml file in Oracle and located the following line HOME NAME="OraClient10g_home1" The client is 10.2.0

3) I then updated the web.config entity framework connection string so it said Home=OraClient10g_home1;

4) For good measure, though not sure it is needed, I created a system wide environment variable called ORACLE_HOME with the full path to the client install.

5) I then went to
http://www.devart.com/dotconnect/oracle ... yment.html
and followed the instructions to update my web.config on the server changing the version to 6.10.126.0

6) I'm confused about deploying the EF & Linq DLL being separate. Why doesn't the Minimal install take care of that? If I look under References in my Visual Studio project, I do not have *any* references to DevArt DLLs, but it works great. Should I add those in there and mark them as CopyLocal = True?

7) And this just made no sense to me at all:
http://www.devart.com/dotconnect/oracle ... ml#general
Maybe this is because of point #6 above, but if I'm deploying MVC and installing DevArt Minimal on the server, do I need to follow any of these steps? The Wizard said: License is not needed. The library does not have reference to Devart.Data.Oracle.

I'm sorry if these seems like a ton of stuff, but I figured if I was confused, then somebody else was probably confused too, and maybe this will help somebody else.
CadeThacker
 
Posts: 4
Joined: Mon 04 Apr 2011 23:19

Postby AndreyR » Tue 05 Apr 2011 14:17

You should add the Devart.Data.Oracle.Entity.dll (please check that it corresponds to the .NET Framework version on the server) if you are using Entity Framework.
Some general tips about the "Can not find Oracle home" problem:
1. Please check that your application has capacity corresponding to the capacity of your Oracle client (32-bit or 64-bit).
2. There was no need to add the ORACLE_HOME variable. But please check that the Path system variable contains the path to the Oracle client location.
If none of these tips are helpful, please try deploying a simple console application.
Please let us know about the results.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby joao88 » Tue 05 Apr 2011 21:08

i have the same problem here. I am stuck too.

I am use code only and EDM in the same project but when i use piece of
application with EDM works. when i use code only piece of software got:

Erro: Unhandled Error in Silverlight Application Submit operation failed. The provider did not return a ProviderManifestToken string. Inner exception message: Can not load Oracle client library oci.dll from home .

so i think "i will use 32bit" but when i use 32bit oracle home, devart doest not found oracle home.

need some help.
joao88
 
Posts: 6
Joined: Wed 12 Jan 2011 20:42

Postby CadeThacker » Tue 05 Apr 2011 21:56

AndreyR,
Thanks for the reply. See below

1) Per your suggestion, I created a console app as follows:

Code: Select all
static void Main(string[] args)
{
  try
  {
     var model = new Entities();
     var things = from m in model.THING
                    select m;

      Console.WriteLine(string.Format("Found {0} things.", things.Count()));

  }
  catch (Exception ex)
  {
      Console.WriteLine(ex.ToString());
  }
}


2) I added a reference to the Devart.Data.Oracle.Entity.dll and set it as copy local = true.

3) I wanted to rule out everything else before we continue to dig, so the DBA completely removed the Oracle Client and reinstalled it x64 (which matches the Windows 2008 R2 x64)

4) The PATH variable does contain the path to the client directory.

When I execute the console app it shows the following:


Code: Select all
C:\Users\myaccount>DevArtTestConsole.exe System.Data.EntityException: The underlying provider failed on Open. ---> System.InvalidOperationException: Can not find Oracle home.
   at Devart.Data.Oracle.OracleInternalConnection..ctor(ae connectionOptions, OracleInternalConnection proxyConnection)
   at Devart.Data.Oracle.cq.a(i A_0, Object A_1, DbConnectionBase A_2)
   at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, i A_1, DbConnect
[snip]


For reference sake here is my app.config

Code: Select all


 
                                    provider=Devart.Data.Oracle;
                                provider connection string="
                                                                User Id=MyUserName;
                                                                 Password=MyPassWord;
                                                                 Server=sandbox.world
                                                                 Home=OraClient10g_home1
                                                           ""
                                providerName="System.Data.EntityClient" />
 



 
   
         description="Devart dotConnect for Oracle"
     type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle,
       Version=6.10.126.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
 





Any other suggestions? If I change out the connect string to Direct=true, then it works as expected. So definitely something to do with working with the local Oracle client.
CadeThacker
 
Posts: 4
Joined: Mon 04 Apr 2011 23:19

Postby AndreyR » Wed 06 Apr 2011 11:15

Please check that your application is compiled in x64 capacity as well. The wrong capacity can cause the error (our code does not depend on capacity, but Oracle Client does).
Let us know if the error persists.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby CadeThacker » Wed 06 Apr 2011 18:50

Per the x64 Capacity here is what I verified

1) The OS is Windows 2008 R2 (64-bit)

2) The oracle client is x64

3) The code was compiled in Visual Studio 2010 with "Any CPU" selected in the project.

Per http://msdn.microsoft.com/en-us/library/zekwfyz4.aspx

Executables compiled with the /platform:anycpu will execute on the 64 bit CLR.

----

For the moment, we have changed the connection string to Direct=true, so we are moving forward, but still really need to get this working.

What next?
CadeThacker
 
Posts: 4
Joined: Mon 04 Apr 2011 23:19

Postby AndreyR » Thu 07 Apr 2011 07:50

This is a known situation. Yes, executables compiled with "Any CPU" Platform will execute with 64-bit CPU.
The issue is that 64-bit Oracle Client expects 64-bit application to work with. Please recompile the project in 64-bit mode.
Let me know if this advice isn't helpful.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby joao88 » Fri 08 Apr 2011 18:06

AndreyR wrote:This is a known situation. Yes, executables compiled with "Any CPU" Platform will execute with 64-bit CPU.
The issue is that 64-bit Oracle Client expects 64-bit application to work with. Please recompile the project in 64-bit mode.
Let me know if this advice isn't helpful.


i have the same issue here, my app doesnt compile if i set 64-bit, but compile
any-cpu. i am using silverlight+asp.net+ef4 code only. in same application i am
using edm and connect oracle client works, but if i use code only crashes with
error above. I cannot use direct mode because i am using oracle RAC

i am work 1 week in this issue can help me solve?
joao88
 
Posts: 6
Joined: Wed 12 Jan 2011 20:42

Postby Shalex » Tue 12 Apr 2011 17:09

joao88, please give us the following information:
1) the capacity (x86 or x64) of your Oracle client;
2)
my app doesnt compile if i set 64-bit

Which errors are you getting?
3)
in same application i am
using edm and connect oracle client works, but if i use code only crashes with
error above.

As you have mentioned, you are getting:
Erro: Unhandled Error in Silverlight Application Submit operation failed. The provider did not return a ProviderManifestToken string. Inner exception message: Can not load Oracle client library oci.dll from home .

Could you please specify your stack trace?
4) have you added data model to your web application via Domain Service? Here is a walkthrough.
5) tell us the mode (x86 or x64) your web application is running in.
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Postby CadeThacker » Mon 18 Apr 2011 16:04

I just wanted to post back that we did finally solve this issue, but it was definitely trial and error.

Back on April 5, I tried to solve this and ran into errors. I put this to the side for a couple of days. Then I came back and worked through this very meticulously. I created a tiny console app and compiled three ways:x86, x64, and AnyCPU. I moved all three from my x86 laptop to my x64 server. The AnyCPU and x64 worked correctly against the Oracle Client (OCI). The x86 failed with the "Can not find Oracle home". Results as expected.

OK, cool. Success.

Then I created a new empty MVC3 app, and added one controller with one action. I then copy and pasted the code from the console app (listed in my posting above on April 5) into my action on the controller.

I also compiled this app 3 ways: x86, x64, and AnyCPU. I then deployed all three to the server under different urls. As with the console app, the x64 and AnyCPU worked and the x86 failed with the same error.

The only thing that was weird was I was getting some odd errors, so I had to run IISRESET on the server, but that cleared everything up.

So AnyCPU did end up working correctly. A good "Clean Solution" is always a good thing. When I tried the console app back on April 5, I was in a hurry, so no telling if I just copied the wrong exe over.

Thanks for all your help and patience.

--cade
CadeThacker
 
Posts: 4
Joined: Mon 04 Apr 2011 23:19

Postby AndreyR » Wed 20 Apr 2011 14:44

Cade, glad to hear the issue is resolved.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for Oracle