Usually there is no problem connecting to an old Oracle database with a newer client driver, for example. to connect to a 10g or 11g database with a 12g client. The rest of the answer relates to technical problems that may arise in your .Net program if the Oracle client client (possibly) is already installed on the computer running your program.
Update 2014:
At the same time, Oracle released a managed .Net driver for the Oracle database. Therefore, instead of installing a local Oracle client or delivering Instant Client along with your application, the preferred way should be to provide only a managed driver without any dependencies on local configurations. Then you have no problems with installed clients, GAC, version of Oracle database and so on. You can download the managed driver from the Oracle website .
The previous answer is still needed if you cannot use a managed driver:
Problems begin if you do not know if there is an Oracle client installed on your client workstations. If you are talking about the GAC , I assume that you do not know if the Oracle client is installed and if so, which version .
If you do not want to rely on the installed Oracle client, you can deliver the Oracle Instant Client with your .Net application. For example, you can download ODAC 11.2 Release 4 (11.2.0.3.0) using Oracle Developer Tools for Visual Studio , which gives you an Oracle Client installation for a developer workstation (with Visual Studio support for developing DataSet and EntityFramework), as well as for all files needed for an instant client.
For the instant client, you will need the following files (find them in subfolders of your ODAC installation):
- oci.dll
- OCIW32.DLL
- Oracle.DataAccess.dll
- orannzsbb11.dll
- oraociicus11.dll (if you use English, otherwise the corresponding .dll)
- OraOpd11w.dll
- tnsnames.ora (if you need it)
In addition, the following DLL files are required in the Windows directory:
Just copy all these files to the working directory of your application (where the .exe file is located).
Now, how does this relate to the GAC?
If the Oracle client is installed on the client computer, the Oracle.DataAccess.dll is also in the GAC. It is also possible that a policy has been set up that states something like: regardless of the version of Oracle.DataAccess.dll your program references, the version of Oracle.DataAccess.dll from your GAC should always be used. If you install the ODAC that I linked above, you will find this file under
C: \ Windows \ Microsoft.NET \ assembly \ GAC_32 \ Policy.4.112.Oracle.DataAccess \ v4.0_4.112.3.0__89b483f429c47342
As a result, your .Net application always throws an exception if you try to load Oracle.DataAccess.dll (with an error message like "The provider is incompatible ..."), if the client machine has a different version of Oracle Client 11 installed than the one you indicate in your application.
To solve this problem, you can configure your app.conf so that the publisher policy is ignored and your version is always loaded:
<configuration> ... <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" /> <publisherPolicy apply="no" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>