C# Console Application getting 'Oracle.DataAccess.Client.OracleConnection' exception

I am getting this Oracle connection exception.  The Oracle connection properties are correct, as I can use the same credentials to connect via TOAD or SQLDeveloper.

Is there any other dll's or anything else I need to remove this error?

I am using Visual Studio 2010 C# and Oracle 10g.

Thank You

Error Message Below:
"An unhandled exception of type 'System.TypeInitializationException' occurred in ExecuteQueryToXml.exe

Additional information: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."
Who is Participating?
käµfm³d 👽Connect With a Mentor Commented:
The provider is not compatible with the version of Oracle client
There you go:  You have either the wrong client installed, or you installed the wrong version of ODAC. Make sure you have downloaded the correct version of each.

Since it works in TOAD, your client is most likely fine. Make sure the version of ODAC that you downloaded works with that client.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Oracle client is the first thing to look at in regards to 32vs64 bit compiling.
Unless you have more detailed error messages, it will be difficult to tack this one.
käµfm³d 👽Commented:
See if there is anything in the Inner Exception property of that exception. If you got the standard exception window popup, then there is a "View Detail" link on the lower left of that window with which you can inspect the Inner Exception.
MachinegunnerAuthor Commented:
Thanks for the replies.

It is "bombing" on the line below:
OracleConnection connection = new OracleConnection(connectionStr);

The messagebox comes up with the title - "Microsoft Visual Studio"
and then the vague error message and then 3 buttons below that are:
"Break", "Continue" and "Ignore".  The Ignore button is grayed out.

Sorry, there is no "View Detail" link to access and the vertical scrollbar is
grayed out as well, as if you could or try to see if anymore info is provided.

When I click the Break button, I can see the Inner Exception message then,
from the local variables;

Inner Exception "The provider is not compatible with the version of Oracle client"
MachinegunnerAuthor Commented:
I went ahead and downloaded this:



I installed it and then tried running the console app or debugging it and it opened the Oracle connection!  So all is good now.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.