Properly Install Oracle ODAC With ODT 11.2.3.20 - oracle

Ok - I have VS 2012 and VS 2013 installed on a 32-bit developer machine running Windows 7 Enterprise and am attempting to connect to an Oracle 9 database. I can install version 12.1.0.24 without a problem, and I can connect to most databases using ODP.NET Managed and Unmanaged drivers through Server Data Connections tool, etc. Problem is that I also have to build applications that connect to legacy Oracle DB Server instances, and really need an older version of the VS Tools and ODP.NET / ODAC, ie 11.2.3.20. This seemingly installs correctly, but when you try to build a new data connection, the default Data Provider is ".NET Framework Data Provider for Oracle" There is an option for "Oracle Data Provider for .NET", but there is seemingly no way to specify a tnsnames.ora location, and the only option available in the "Data Source Name" combo is "(Local Database)."
Furthermore no option for picking Managed or Unmanaged for the Provider is available. Can somebody please tell me the proper thing to do to get this to work? Are there machine-wide configurations I have to make manually, that the installer for 12.1.0.24 does automatically?

Usually there is no need to install more than one Oracle Client (resp. one each for 32-bit and 64-bit). You can connect to older database with 12.1 client (for Managed Driver the Database must be 10.2 or newer).
Most likely you messed up your Oracle installation, remove them all and install one version from scratch.
In order to make you application independent from installed Oracle Client open *.csproj, resp. *.vbproj file and edit reference to ODP.NET like this:
<Reference Include="Oracle.DataAccess">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
Attributes like Version=... or processorArchitecture=... are not required. Your application will load the correct Oracle.DataAccess.dll depending on selected architecture and target .NET framework (provided that it is installed properly)
"Oracle.DataAccess" and "Oracle.ManagedDataAccess" are different assemblies, so you cannot use them seamless - unless you use DbProviderFactory and such stuff.

Related

Add providers to VS 2008 Connection Manager?

With Visual Studio 2008 I'm trying to connect to an Oracle database using Oracle Provider to OLE DB (the only Oracle driver available in dropdown), and I'm having issues with it. So I'm trying to add other drivers to that VS2008 "Connection Manager" dropdown. Unfortunately, I only see the ones in this screenshot
How can I add other drivers to this dropdown? When I create an ODBC driver, I see several other Oracle drivers to choose from that I don't see in the VS2008 dropdown.
You installed more than one Oracle Client, this is always a bad idea. Usually there is no reason to install more than one Oracle Client, i.e. one each for 32-bit and 64-bit.
For OLE DB you cannot install more than one driver (per architecture), see Installation Considerations for Oracle Database Client:
You can install all Oracle components in multiple Oracle homes on the
same computer. However, some components can only support one active
instance at a time. This means that the current (latest) installation
renders the previous one inactive. These components are:
Oracle Administration Assistant for Windows
Oracle Provider for OLE DB
This is a limitation in COM. So, you cannot add other providers, at least no other Oracle Provider for OLE DB
You could use the Microsoft OLE DB Provider for Oracle (MSDAORA), however this has been deprecated for ages and it is really not recommended to use it.
Instead of OLE DB you could also use ODBC or use the Oracle Data Provider for .NET, you can download and install it from here: 32-bit Oracle Data Access Components (ODAC)
As far as I know Visual Studio 2008 supports only .NET Framework only up to version 3.5, thus you would have to use the Oracle Data Provider for .NET 2.0, version 4 will not work.
Maybe this list provides an overview for you: How to connect to Oracle 11 database from . net
If you like to get a list of all OLE DB providers which are installed on your machine, check this one: How to check the version of oracle provider for ole-db. OraOLEDB.Oracle provider

ODAC for visual studio 2013

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.

ODP .Net 12 using OraClient11

I know that the request may look somehow weird but I am trying to develop a .Net application using EF and Visual Studio 2010 against a ORACLE 10g DB.
Initially I tried with EF4 which is the embedded one in VS2010 and with ODP11 I am able to make it work. But due to some specific bugs in EF4 (StoreGeneratedPattern bug) I want to go to EF5 or EF6.
While "googleing" a bit I was able to Install EF6 using the nugets and adding the context generator for EF using the following explanation:
https://msdn.microsoft.com/en-us/data/jj206878.aspx
The problem here is that the system is not able to find a proper ODP provider for Entity Framework as I only have ODP11 installed.
Again after investigating a bit :) I saw I need ODP12 which will have full support to EF. My problem here is that all servers will be working with OraClient 11g against a Ora10g DB... I know there is no major problem (at least for the use I need) to use Ora11Client with a Ora10Server but what about ODP? I cannot change the Oracle client and I am wondering whether I can face any issue by having my application developed with ODP12 and being executed in a machine with Ora11g Client.
Is anyone having some advice on this?
Thanks a lot in advance!!
It's my understanding that the managed driver for 12 (Oracle.ManagedDataAccess and Oracle.ManagedDataAccess.EntityFramework available on NuGet) will connect to 10.2 and above and does not require ANY client installed on the computer as it contains the client it needs. It just gets installed in the app's bin directory. Be aware though that it doesn't seem to currently work with .NET 4.0 in case you're still targeting that. The 4.0 version of Oracle.ManagedDataAccess.EntityFramework shows up on NuGet as a beta version and is actually compiled against .NET 4.5.
ODP.NET 12.x has a dependency on the Oracle 12 client software so you cannot use it with the 11 client stack. You can use ODP.NET 12 to connect to databases going back to version 10.2.
You can embed the ODP.NET, unmanaged client stack in your app by using the Xcopy download, or you could use the ODP.NET, Managed Driver which is just one DLL and less than 10 MB in size.
Oracle has the concept of an "Oracle Home" (subdirectories) to allow multiple versions of software to run side by side. So that version 11 Client on your servers can exist alongside with the version 12 software you deploy there.

Why is the SQLite provider missing from the Server Explorer Add Connection dialogue?

I am following the article Using SQLite Embedded Database with Entity Framework and Linq-to-SQL, and have tried installing the SQLite provider, first using the System.Data.SQLite NuGet package, and then by installing the provider via the Setups for 32-bit Windows (.NET /Framework 4.0) installer package (for v1.0.79). After both installs, and a system restart, I still see no SQLite Database File provider in the Add Connection dialogue from Server Explorer.
I can proceed by manually creating a connection string and using external tools to create my SQLite database file, but I still would like to know what is wrong why I do not have the advertised design time support for SQLite despite having installed the latest provider. What could be wrong here?
Ensure the data tools for visual studio were installed correctly as per:
http://www.basarat.com/2010/05/sqlite-for-visual-studio-2010.html
There are various fixes listed, making sure there weren't older tools installed first, etc.
I'm going to give it a try, but the article may help you out.

Is ODP.NET required for Oracle 11g Client?

I may be asking the wrong question here, I'm willing to change it if so.
I have a project that is using the Microsoft.NET Oracle provider (our plan is to change to ODP but we haven't done so yet).
I am trying to get this project to build on a windows 2008 (x64) build server. It builds just fine but our unit tests fail when they hit stuff on the Oracle database.
I had initially installed the 32bit oracle 9i client which is what we currently use on our winxp dev boxes and the previous 2003 build server. But now this gets a message like: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
We tried compiling to the x86 platform but that didn't change the error message.
I now have the 11g 64 bit client installed but I am getting a message saying System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
So what Oracle install should I be using?
Edit:
I was able to get this to work. Turned out it was the testing causing the problem, by forcing NUnit to run in 32bit mode: Link I was able to get the tests to work using the old 32 bit driver. This would be a crappy answer to the question so I am not using it but will gladly award the correct answer to anyone putting in some good info on transitioning to Oracle 64bit drivers.
When it comes to Oracle, I like to use Oracle Instant Client :
You don't have to install anything on the target machines (including dev boxes !).
You can make sure that your application will run with the specific client you picked.
You could even easily have multiple applications work with different client versions on the same computer.
As a downside, it adds a significant weight to your application (~19Mb minimum).
Check What is the minimum client footprint required to connect C# to an Oracle database? for more information. To know how to set up a Visual Studio project that will work on x86 as well as x64 machines, check my blog post Oracle Instant Client in Visual Studio.
I'm adding a new answer since as of this fall (2012) the ODP Managed Code Beta is available. See this link for more information. It is for us highly stable and we are using it in production, mainly because of these reasons:
No installation (except for entity framework where a simple registration is needed)
It is smaller than the unmanaged version, the footprint is approx 6 MB.
It is NOT "bit sensitive", ie Any CPU will finally work with ODP :)
More intuitive mapping C# types <-> Oracle types (and it solved some problems with EF and model generation from database)
Supports EZCONNECT (all versions of the unmanaged ODP did not), ie no more tnsnames.ora hassles.
But for transitioning to 64 bit, download the managed ODP driver and change the Oracle.DataAccess reference to Oracle.ManagedDataAccess and recompile :)
I think the message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater" it's similar to "Oracle client not installed, installed but not found or installed but it's needed 8.1.7 or greater".
Check on regedit if the values are right under the key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraOdac11g_home1
Where OraOdac11g_home1 depends on the Oracle Home name for your installation.
Also, try to connect through Visual Studio to see if its possible.
I have had an issue which could relate to what you are seeing.
I initially had the just the Oracle 10g client installed on my machine and the .Net Oracle.DataAccess component version number was 10.2.0.100 - this was for .Net runtime v1.0.3705
I installed ODP.Net and the Oracle.DataAccess component version is now v2.102.2.20 and runs on .Net runtime v2.0.50727 - I cant find the reference as to why Oracle did this - it was something to do with bringing version numbers in line with the runtime version
It took me a day to work this out. We dont use the 11g client yet and I havent used the 8i client for ages so I dont know what the version numbers would be for those clients, but I'd check it if I were you what.
In short, Oracle back-tracked the component version numbers which could be making your 11g component appear out-of-date as opposed to Oracle 8i components
I have found many times that the error "requires Oracle client software version 8.1.7 or greater" is a notoriously misleading error. From distant memory I seem to remember that this usually indicates a file IO permissions problem. I think it may be that the ASP.NET worker process (or whichever identity an application is running under) requires some sort of read or write permission to a folder in the oracle client folder hierarchy...
This can be a cause of multiple oracle homes in the environment. Remove the older version oracle home in your build system. try generating the build again with the single home. There are some issues with 9i version ODP.NET and 10G/11G connectivity

Resources