System.TypeInitializationException with Oracle.DataAccess.dll
748337Jan 26 2010 — edited Jun 7 2010Hi All, I'm getting the following error when creating a new Oracle Connection by doing
Dim connection As OracleConnection = New OracleConnection()
to Oracle 10g XE on my local host.
Error:
=====================
System.TypeInitializationException occurred
Message="The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."
Source="Oracle.DataAccess"
TypeName="Oracle.DataAccess.Client.OracleConnection"
StackTrace:
at Oracle.DataAccess.Client.OracleConnection..ctor()
at Deltek.Framework.Ancestors.Server.OracleLayer.GetConnection() in <file location>
InnerException: Oracle.DataAccess.Client.OracleException
DataSource=""
ErrorCode=-2147467259
Message="The provider is not compatible with the version of Oracle client"
Number=-1011
Procedure=""
Source="Oracle Data Provider for .NET"
StackTrace:
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleConnection..cctor()
InnerException:
=====================
My env :
OS : Windows 7 64 Bit Enterprise Edition
IDE : Microsoft Visual Studio 2008 SP1
Database : Oracle 10g XE 32 bit ( Release 10.2.0.1.0 )
Oracle.DataAccess.dll version 2.102.2.20 ( In TFS: Oracle.DataAccess.dll in TFS is referring to this file, Copy Local = False, Specific Version=False, Stron Name = True )
I have not set any Oracle variables : for example ORALCE_BASE, ORACLE_HOME, ORACLE_SID etc. so none exist
Path contains : C:\oraclexe\app\oracle\product\10.2.0\server\bin;
Installed ODAC 11g version in C:\oraclexe\odac. ( location of OraOps11w.dll is C:\oraclexe\odac\bin )
Now, I have the following questions :
1. How can I fix this issue :-)
2. Not sure the error I'm getting is related to environment variables..but it is, how can I set them properly..
I've seen oracle_home variable set in so many different ways..this is what I'm planning to add to my env..pls let me know if you have any suggestions/recommendations,
ORACLE_BASE = C:\oraclexe\app\oracle
ORACLE_HOME = %ORACLE_BASE%\product\10.2.0\server
add to path : %ORACLE_HOME%\bin
If you could give me an example of how to set these variables..that would be great..
3. I've installed ODAC ( ODAC1110720Xcopy )
install odp.net20 c:\oraclexe\odac odac11..did I install this ok?
or should I have done this..
install odp.net20 %ORACLE_HOME% odac11 ( where %ORACLE_HOME% is set as mentioned above )
Please let me know if you want more information.
Cheers