I'm trying to create a sample project with EF4 for an Oracle Database.
In my PC I created a project.
Some of the characteristics (if more info is needed please say so)
- Visual Studio 2010
- Entity Framework 4.1 with DB First + DbContext
- Platform target "Any CPU"
- Oracle BD 11g
- My DB connection was created by using "Server Explorer" -> "Data Connections" -> "Oracle Data Provider for .NET"
- I have one Oracle Home 11.2 with both client_32 and client_64 folders
- I make no reference to Oracle.DataAccess.Client in my project
- In my GAC I find Oracle.DataAccess vs 2.112.3.0 x86, 2.112.1.0 x86, 2.112.4.0 AMD64, 2.112.3.0 AMD64, 2.112.1.0 AMD 64
- listing my pc providers I get
- Odbc Data Provider Version=4.0.0.0
- OleDb Data Provider Version=4.0.0.0
- OracleClient Data Provider Version=4.0.0.0
- SqlClient Data Provider Version=4.0.0.0
- Oracle Data Provider for .NET Version=4.112.4.0
- Microsoft SQL Server Compact Data Provider Version=3.5.1.0
- Microsoft SQL Server Compact Data Provider 4.0 Version=4.0.0.0
Running the project (that makes a simple add using one of the entities generated by the EF) in my pc, works fine.
The server:
- Windows Server 2008 R2 Standard
- 1 Oracle home in app64/32, vs 11.2
- All my IIS AppPools can run 32bit
- In GAC I have Oracle.DataAccess 2.112.1.0 x86 and AMD64
- listing for providers I can see
- Odbc Data Provider Version=4.0.0.0
- OleDb Data Provider Version=4.0.0.0
- OracleClient Data Provider Version=4.0.0.0
- SqlClient Data Provider Version=4.0.0.0
When running the program on the server i get the following error: "[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)"
Looking at the providers I realized that the provider "Oracle Data Provider for .NET" was missing in the server, so i tried multiple oracle installations (ODAC, ODP, XCopy) but nothing seems to work, althouth several files were installed (I used the existing oracle home), the provider keeps not showing, in the registry, under SOFTWARE\ORACLE\ODP.NET I keep only seeing 2.112.1.0 version.
After this i tried to deploy my exe with the oracle DLLs and even change the app.config to include
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.DataAccess.Client" />
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral,
PublicKeyToken=89b483f429c47342"/>
</DbProviderFactories>
but i get the following error: System.Data.EntityException: The underlying provider failed on Open -> Oracle.DataAccess.Client.OracleException: ORA-12557: TNS:protocol adapter not loadable.
Searched for the error and somewhere i found i should try the EZConnect form (user/pass@host:port/sid) but then i get a configuration exception...
As of right now, other aplications that were running using oracle (I can't see how these are running) stopped working, so I'll have to go back befora all my installations...
I've been in this for 3 days now and I really don't know what to do. After the server has been restores does anyone know what else can i try?
========================= UPDATE 1 ================================
After my server got restored to before all this i noticed something i forgot to check
in regedit I have:
- HKEY_LOCAL_MACINE/SOFTWARE/ORACLE/KEY_OraClient11g_home1/ORACLE_HOME -> D:\app64\product\11.2.0
Obviously I have my oracle stuff with 64bit, so my next move was to change my program for 64bit. This resulted in the same error, after that i figured i needed to instal the 64bit ODAC. I downloaded ODAC112021Xcopy_x64 and installed it. With this the Oracle Data Provider for .NET Version appears (but version 4.112.2.0). Running my app now gives the following error :
system.data. provider incompatible exception: the store provider factory type 'Oracle.DataAccess.Client.OracleClientFactory' does not implement the IServiceProvider interface
After searching for the error I wen to check GAC64 bits. I can see oracle.dataaccess.dll in C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342.
What should be my next step? unistall this odac and try some newer version of 11? reading this (http://netdevelopmentmanfreddahmen.blogspot.pt/2013/07/c-error-store-provider-factory-type.html) it seems you need, for EF, version 112.3.0 or later and .Net 4 or later
And guess what? tchanan!! it worked :)
Good news is that, installing this ODAC did not affected (as far as i could see) the remaining and already running apps using oracle.
NOTE: I installed ODAC using the command install.bat all D:\app64\produc t\11.2.0 Oracle - OraClient11g_home1