For all the non-geniuses like me, I don’t have much experience
working with Oracle, and had a challenging issue using the correct Oracle
Library in my C# project.
There are 2 main types of libraries to connect to Oracle
Database, one is provided by Microsoft(System.Data.OracleClient) and other by
Oracle(Oracle.DataAccess.Client). To keep this conversation to a simplistic
level I’ll not deep dive into the other library choices that we have. But in
order to work with any of these you need to have the oracle client installed on
your machine.
After brushing it under desk, I decided to revisit and
address this issue. One of the most compelling reasons was that Microsoft
Drivers have been deprecated in favor of Oracle supplied drivers, so it was
important to understand the issue and solve it.
After a lot of research and trial-error, I identified that
it was due to the difference in file bit versions.
So, go to Platform and switch to “Any CPU” and close.
Rebuild your solution and it should work like a charm.
Hopefully, this resolves your issue.