Link to home
Start Free TrialLog in
Avatar of Steve A
Steve AFlag for United States of America

asked on

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

Hello,
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."
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

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.
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.
Avatar of Steve A

ASKER

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"
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve A

ASKER

I went ahead and downloaded this:

http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

ODTwithODAC112030.zip

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