I have an Oracle(12g x64) database that I am trying to connect to using EF (6.x.x) data first approach in an MVC application. However I get a BadImageFormatException.
I am running everything x64. "Any CPU" is changed to x64. IIS AppPool "Allow 32-bit apps" is set set to false. Project Platform is set to x64
The same environment works fine with plain ADO.NET connections.
Has anyone successfully achieved this?
EDIT:
This link
does not provide the answer. I am getting the error only when trying to connect through Server Explorer. Plus, I am using everything x64 to work with my other project. If I install another (x86) client and/or change paths of the current client and dlls it will mess up everything for the other project also.
I have installed the Oracle.ManagedDataAccess and the Oracle.ManagedDataAccess.EntityFramework nuget packages in my MVC (current) Project. So it removes the requirement for a x86 client.
I will try to enumerate the steps.
From here: http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html
Download Entity Framework "Oracle Developer Tools for Visual Studio 2015 - MSI Installer" This will provide the EF tools. These tools are compiled in x86
Download "64-bit ODAC Downloads" I would suggest the "64-bit ODAC 12c Release 4 (12.1.0.2.4) for Windows x64" wich has an installation wizard
Use Nuget to install Oracle.ManagedDataAccess.EntityFramework nuget packages in your project
Go to your web-->properties--> and set platform target to x64 in Release Mode
At this point, it should work properly in debug mode and release mode in your machine
In the IIS server you should only install "64-bit ODAC 12c Release 4 (12.1.0.2.4) for Windows x64" and configure the tnsnames file
Deploy all the contents of the bin\x64 folder to the IIS server. No further configuration in IIS if it´s an x64 operating system
Hope it helps
Related
I get the following error message when I try to test my connections:
Test connection failed because of an error in initializing provider. The 'OraOLEDB.Oracle.1' provider is not registered on the local machine
I originally had 32 bit and 64 bit version of Oracle 12 client installed on my work machine. I uninstalled the 32bit version, because it was causing some conflicts with another application, but now after uninstalling I can no longer use my oracle connections in SSIS.
I'm using Visual Studio 2017 - I am pretty sure I installed 64bit version of SSDT, but it looks like they install under the 86x programs folder. I can still connect via TOAD, so it looks to be an issue of SSIS not pointing to the 64bit installation, I think. Can I manually set SSIS to point to the 64bit version, or do I need to reinstall 32bit?
TSN_Admin is set to the oracle12c_64 tsnname.ora file. I have also tried using the regsvr32.exe on oraoledb12.dll file, but I get an error message, even after running command prompt as admin:
The Module "OraOLEDB.dll" was loaded by the call to DllRegisterServer failed with error code 0x80070005.
I can reinstall the the 32bit version, but I need to wait for my company's IT department to approve the request first. It could be days before I get a response.
Update 1 - Visual Studio 64-bit
After searching it looks like there is not Visual Studio 64-bit version:
Visual Studio 64 bit?
Initial Answer
I don't know if there is an official documentation for this, but based on my own experience you need to instal oracle client 32-bit on the developpement machine, because SQL Server Data Tools for Visual studio is a 32-bit application and it will not work will work with oracle client 64-bit.
But you can execute .dtsx package without any issue if you are working with oracle 64-bit client, you need to use the appropriate DtExec path:
32-bit
C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DtExec.exe
64-bit
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DtExec.exe
While searching, i found many other links that share the same opinion:
Oracle Install for SSIS connectivity (and drivers 32 64 bit)
Oracle Client Provider for OLE DB in SSIS not working
Connecting to Oracle 11g on 64-bit (x64) machine SSIS 2012
There are a lot of ODAC download at the Oracle website but I want to know what is the right ODAC to download for my VS 2013? I have a Windows 7 64-bit OS.
And also, do I need to install ODAC on BOTH my laptop (where I will create my project) and to the Oracle database server?
When I'm trying to connect to my Oracle database, it throws me this error:
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater
so I read other blogs saying that I should install ODAC, but these blogs example are using either VS2005 or VS2008, but mine is VS2013
Start with easy answers:
No, you don't have to install any ODAC on Oracle database server (most likely they might be installed anyway by default)
It does not matter at all which Visual Studio you have, regarding Oracle installation they are all the same.
Now regarding your error:
"Microsoft .NET Framework Data Provider for Oracle", i.e. System.Data.OracleClient is deprecated for ages, you should not use it in new projects. You should use the Oracle provider "Oracle Data Provider for .NET" (ODP.NET), so by downloading ODAC from Oracle you have been on the right path.
When you like to use ODP.NET you also have to install an Oracle Client, otherwise it does not work (this requirement is also valid for System.Data.OracleClient, that's the actual error you get).
You can either install "Oracle Instant Client" and ODP.NET or download full Oracle Client where you can make a "Custom" installation. There you have to enable component "Oracle Data Provider for .NET" at least.
It is important to have everywhere the same architecture, i.e. Oracle Client, ODP.NET and your application must be all the same - either x86 or x64 ("AnyCPU" means x64 on nowadays 64-bit Windows). In case you have to support both x86 and x64 follow this instruction to install x86 and x64 on one machine.
Another possibility is to use the "ODP.NET Managed Driver", this one is just a single .dll and does not require any further Oracle client installation. Unlike "ODP.NET" the "ODP.NET Managed Driver" does not depend on the architecture, i.e. it works for both x86 and x64.
It does not matter whether your database is 32-bit or 64-bit. This applies for everything mentioned above.
I got ODTwithODAC121021 here It installs the Oracle Client, ODAC, and ODT bits.
When I run the installer, the prerequisite check fails with this:
Reference data is not available for release "12.1" on the operating system distribution "Windows XP5.1".
I actually have Windows 7 Professional SP1
Huh?
My intent is to get the ODT bits into Visual Studio 2010 so I can use Server Explorer and Entity Framework. I don't really need a new Oracle Client, I've already got one installed to match our 11g server version, but it seems I can't pick and choose with this installer, which won't run.
Suggestions? thanks.
This is a bug in this specific version of the Oracle Installer. Here is the workaround:
After making sure the installer is not running, please open up this file in the staging area where you unzipped ODAC:
....\stage\cvu\cv\admin\cvu_config
And in that file change the CV_ASSUME_DISTID value that is there to 6.1
Then save the changes and run the installer again.
This will force the installer to assume you have Windows 7.
I've got two Windows XP machines with both Visual Studio 2008 and Oracle Client 10.0.2.0.1 installed. One is a development machine and the other one a dedicated build machine. The machines were probably not set up the same way.
On my development machine, I've included Oracle.DataAccess.dll (version 10.2.0.1.100, not the asp.net v 2.x one) in a C# project. Note that the System.Data.OracleClient dll is insufficient (I don't properly remember why, I think it had something to do with bulk insertion/selection).
I was able to select that DLL from the Project->Add Reference dialog in the .NET tab.
Now on the build machine, I cannot build the project as it cannot find the .dll. The .dll is located in the same folder as on the development machine, (<installdir>\10.2.0\client_1\bin\Oracle.DataAccess.dll) in the same version.
The .dll is however not displayed in the .NET tab.
I tried (re)installing ODAC with ODP.Net for VS 2008 but it didn't change anything. When looking at the registry, I realized that my Development machine had a registry folder
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\ODP.Net]
which points to the bin directory of my oracle installation. This entry does not exist on the build machine. Unfortunately, manually adding the key did not make Visual Studio find it (I've tried rebooting).
My main question is:
What do I have to do so the Build Machine automatically finds the Oracle.DataAccess.dll? (Note: manually adding the .dll each time the solution is changed would work, but that is not an option).
You can maybe help me out already by answering one of the following subquestions:
Which installer sets that registry entry?
Do I maybe have to reinstall the whole Oracle Client in a different configuration? (e.g. ADMIN)
Do I need more than just the Oracle Client, ODAC and .NET installed?
I managed to resolve the issue by completely uninstalling the Oracle Client on the build machine, then doing a fresh installation using the Administrator configuration rather than the Developer configuration.
Note that installing the Administrator configuration on top of the existing oracle installation did not work.
I'm using the Oracle Data Access(ODP.NET) in a mvc3 project.
the odp.net has both x64 and x86 versions separately and i want to use the x64 version.
I set "Platform target" to x64 and add a reference to x64 version of odp.net, there is no problem to publish on iis server, but i can't run the project for develop and test, however Razor views display errors on c# statements.
How i can develop the project in x64 platform?
I would say the immediate problem is forcing your platform target to x64. The asp.net development server is 32 bit. Either leave it as "Any CPU" or run a 64 bit dev server (either the local IIS server or compile cassinidev as 64 bit). If you do leave it as any cpu so you can continue to use the out of the box dev server, you'll get the same error with the 64 bit version of oracle.dataaccess.dll for the exact same reason.
I install the 32 bit version on my machine (i also install the 64 bit version but I mention that only to note that they run fine side by side). The reference to Oracle.DataAccess.dll does not include bit-ness, only version. So as long as you have the same version (or later with publisher policies) of the 64 bit flavor on the server, everything will run fine once you deploy.