Problem in connecting oracle instance from one of the fresh machine - c#

We have an issue related to connecting the Oracle database 19 c / 12c from one of the Windows 2016 machine build from AWS
The exception we are getting is "The provider is not compatible with the version of Oracle client"
Our application is using Oracle.DataAccess.dll to connect the oracle database. Along with the application build we have added these below binaries so that customers are not required to install the ODAC explicitly
oraociei12.dll
oci.dll
oraons.dll
OraOps12.dll
Our application is running in most of the Windows machine(s) and also with freshly build machine from AWS.
Expect for one of the particular Windows Machine they call as Production, there we are facing an issue. We tried all the possible solution provided in the Stackoverflow and others site, Tries are like
Installing the ODAC explicitly
Checking with GAC
Adding the environment variable
And other possible ways suggested over the net.
Can anybody help here what I am missing here?

Related

Oracle Instant Client v12 - how to use without installation with asp.net?

Currently we have Oracle Client installed on our server VMs but we'd like to use Oracle Instant Client on Azure Service Fabric (without installation). I managed to get it work with version 11 but with v12 I'm still getting below error (far from connecting to database):
"The type initializer for 'Oracle.DataAccess.Client.OracleParameter'
threw an exception: The provider is not comatibile with the version of
Oracle client"
Again: it works without installation with Oracle.DataAccess.dll 4.112.3.0 and Instant Client 11.2.0.3 (both x32) but still can't get it to communicate with the newest versions.
I've worked with several Instant Client how-to articles but all of them are very old (~2013) with inactive links to Oracle downloads... Also I cannot use System.Data.OracleClient Namespace because it lacks a few functionalities we need (fe XxmlType or custom types) so I need to reference Oracle.DataAccess.dll
Here are steps I tried. Please point me what am I doing wrong...
Downloaded and installed OracleClient 12.1.0.1.0 (Oracle.DataAccess.dll v4.121.1.0) - ODAC122010_x64
Copied Oracle.DataAccess.dll from Oracle Home directory (whre it is installed) \odp.net\bin\4 to my project and referenced it
Downloaded Instant Client from Oracle website. Version 12.1.0.1.0 - same as Oracle.DataAccess.dll
Added Instant Client dlls to project (Copy local: Always)
Also I set up Environment like this:
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
Works locally (where Oracle is installed) but shows exception when published on Azure

Oracle EXE application runs on developer PC but not on other users' PCs. Why?

I am developing a Windows application that connects to Oracle DB.
The machine I am developing the application on has Oracle 6i installed with SQLPlus and Toad to access Oracle by command or graphical interface.
The same set up is true across all other computers in my work place.
The only difference is that my pc has Visual Studio and Oracle 10g ODP.Net libraries to make the development of Oracle Application possible using Visual Studio.
I made sure to include Oracle.DataAccess.dll file along with the EXE in the same path to reduce dependency on default paths/ etc.
The finished EXE file runs as expected on my computer, but whenever I publish it to the other computers, I get the following error message:
The type intializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
I tried to change the version of Oracle.DataAccess.dll from 2.111.6.20 to 10.2.0.100.
Again, it ran perfectly on my PC but gave the following exception on other PCs:
Unable to load DLL 'OraOps10.dll': the specified module could not be found.
I copied the said file above from my pc and included it in the published folder of the EXE but the same error message appeared, as if it invisible to the .Net application.
All computers have Windows 7 and all of them are 32bit.
Is there a way to make the application connect to Oracle regardless of the libraries or Oracle version installed locally on the computer? (The same way Toad works whether it detects Oracle 6i or 10g installed)?
I can't install the Oracle 10g ODP.Net libraries on all computers.

asp.net application not connecting to oracle 11g even after installing oracle instant client for 11g

I have a asp.net mvc application which is using oracle 11g database. In development machine every thing worked fine, but while deploying it in production server asp.net application is not able to connect to the database server. It is always throwing an empty exception.
I wrote also a simple console application to test the db connectivity. It is also not working. Then I realized it is because that the machine doesn't have a oracle client installed. so I installed Oracle instant client for 11g database 32 bit version. After this the console application started working but the web application still could not connect.
I google lot and finally decided to analyse using process monitor. In process monitor I found that the web application (iis) is looking for an oraclient12.dll.
This oraclient12.dll is part of oracle client for 12c database. I can't understand why it is looking for this dll.
After installing oracle database client for 12g, the above issue with oraclient12.dll got fixed. but iis is now not able to locate oraclsce12.dll.
I searched the whole file-system for this file but could not find.
does anyone know what should i install to get oraclsce12.dll.
Thanks,
Sujith
I was facing similar issue, then came to know that for the dll to be installed you should now also install the option «Oracle Advanced Security»,, by choosing custom installation when installing the oracle 12 client. I did the same and my issue got resolved. You can try this and see if your issue gets resolved.
thanks Sudharsan
This is documented as Oracle bug 17379890.
Oracle provides two workarounds:
Workarounds include:
To avoid the issue in the first place, explicitly select "Oracle NET" component during install
After the fact, you can
do another custom install into the same home, and select "Oracle NET"
copying ORACLSCE12.DLL from an existing install into OH\bin also resolves the issue.
However, making a single copy of file ORACLSCE12.DLL is not sufficient because there are more files which are missing. The workaround works only for certain applications. For example for tnsping.exe you still get an error due to missing files.
You have to take the first solution, i.e. explicitly select "Oracle NET" component during install

Is ODAC must for C# Oracle Database connectivity using ODP.net

I am new to Databases and .net!
I have SQL developer 3.0 installed through which I can connect to the Oracle 11g Database server.
The requirement is to write a C# program to connect to the oracle database and run query; in my visual studio 2013 project I have added a reference to Oracle.DataAccess.Client and written the code, however while debugging an error occurs that says "Ora-12541:TNS:No-Listener".
My question for now is, Do I need to install an Oracle client (64-bit ODAC 11.2 Release 6 (11.2.0.4.0) Xcopy for Windows x64 ?), my assumption was SQL developer will take care of this!
Please help!
SQL Developer has it's own Oracle drivers (JDBC as far as I know), thus you must install Oracle Client in order to connect to an Oracle DB in Visual Studio.
Note, "ODAC" contains only the ODP.NET Data Provider (i.e. mainly the Oracle.DataAccess.dll file). In order to use it, you must install the actual Oracle Client - at least the Instant Client (which is also included in the ODAC Download file).
Consider to use the ODP.NET Managed Driver, then you need only one single DLL, nothing else. It can be downloaded from Oracle page 64-bit Oracle Data Access Components (ODAC) Downloads and works for both 32bit and 64bit applications.
Unless you copied Oracle.DataAccess.dll from another machine, all oracle packages that include it, also include some version of the client. ODAC includes the full version while the xcopy installs have the instant client. I'll also point to the managed provider though for simplicity as it does not have any unmanaged dependencies,
However, if you got all the way to an "ora-xxxxx" error, it sounds like your Oracle client is correctly installed. The only issue you have now is your connection string. If you normally use a TNS name in Sql Developer, than you either need to copy your existing tnsnames.ora to network/admin in your new oracle home dir, or you need to set a TNS_ADMIN system environment variable to point to your existing one. There are other options too, but your error in this case is tns specific.

Win vs Web: The provider is not compatible with the version of Oracle client

I'm trying to open a connection to Oracle from c#.
I've seen this error a couple of times on the forums with possible solutions. And these solutions did help me - for a WinForm app.
However, if I take my same coding (that works in WinForms) and I put into an ASP.net application, I get the error in the title.
The command that generates this is:
OracleConnection oc = new OracleConnection(ConnectionString);
Additional information:
I have a reference to Oracle.DataAccess (version 2.111.6.20)
I've copied the required dll's to my bin directory (oci.dll, ociw32.dll, orannzsbb11.dll, oraocci11.dll, oraociicus11.dll, OraOps11w.dll).
These are the same DLL's that are working in WinForms.
This error mostly comes due to the incompatible processor architecture(32bit or 64) of the application and the Oracle ODAC dll that you have added as reference. It might work in the client app but not in the web app because you might be running the Asp.net application in incompatible bit version 32 or 64.
In case if you have hosted the site in IIS you will have to check the bit version IIS is configured to run.
EDIT
If the above solution didnt solve your issue, Check if you have Oracle Client installed in your machine. Some database operations needs at least Oracle Client installation(Oracle Express or Enterprise etc). Not having the installation might throw the same exception.

Categories