The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception

I have a VB .Net 2.0 web application which accesses oracle 8i database, the database was upgraded to 9i later on. The application worked fine just before the upgrade was made, but after the upgrade the application gives the following error.

The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.

I did a few searches in the oracle forums and downloaded and installed the Oracle Data Provider for .NET  version 9.2.0.4 form orcale website but the application still throws out the above exception.

following is the stack trace of the application from the point of failure

'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.A first chance exception of type 'System.TypeInitializationException' occurred in WebApplication2.DLLSystem.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>235fed96-1-128578546213452400</AppDomain><Exception><ExceptionType>System.TypeInitializationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.</Message><StackTrace>   at Oracle.DataAccess.Client.OracleConnection.Dispose(Boolean disposing)   at System.ComponentModel.Component.Finalize()</StackTrace><ExceptionString>System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---&amp;gt; Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client    at Oracle.DataAccess.Client.OracleInit.Initialize()   at Oracle.DataAccess.Client.OracleConnection..cctor()   --- End of inner exception stack trace ---   at Oracle.DataAccess.Client.OracleConnection.Dispose(Boolean disposing)   at System.ComponentModel.Component.Finalize()</ExceptionString><InnerException><ExceptionType>Oracle.DataAccess.Client.OracleException, Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342</ExceptionType><Message>The provider is not compatible with the version of Oracle client</Message><StackTrace>   at Oracle.DataAccess.Client.OracleInit.Initialize()   at Oracle.DataAccess.Client.OracleConnection..cctor()</StackTrace><ExceptionString>Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client    at Oracle.DataAccess.Client.OracleInit.Initialize()   at Oracle.DataAccess.Client.OracleConnection..cctor()</ExceptionString></InnerException></Exception></TraceRecord>'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC\Oracle.DataAccess\9.2.0.700__89b483f429c47342\Oracle.DataAccess.dll', No symbols loaded.

would really any kind of help on this, i have already spent days working on this.

thanks in advance

3
rean
6/13/2008 9:36:45 PM
asp.net.oracle 2269 articles. 0 followers. Follow

7 Replies
17763 Views

Similar Articles

[PageSpeed] 51

u add the namespace of oracle and checkout. 


Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.
0
srijaya_ramaraju
6/16/2008 3:03:41 AM
i did add the namespace for orcale. 

Imports Oracle.DataAccess.Client

but the error was got inspite of the namespace.

thing is im really not able to pinpoint the source of the error, i have been able to make connection to the database and all but still not running.

1
rean
6/17/2008 3:10:52 PM

Hi,

 TypeInitializerException occurs when Oracle.DataAccess.dll finds the wrong version of client dll's, or doesnt find them at all.  The exception message indicates you're using 2.102.2.20 opd.net.  So, you'll need 2.102.2.20 oraops10w.dll in your Oracle\bin directory, along with the rest of a 10.2 client install as well. Is that what you have?   Does the 10.2 come before any other Oracle homes in your PATH environment variable?

Hope it helps,
Greg

0
greg
6/17/2008 9:52:17 PM

Hi greg,

Thankyou for replying. I m using orcale version 9i. i found the OraOps9.dll in the c/software/bin i guess thats bcoz thats the folder i downlaoded the file ODAC 9.2.0.7.0. I have orant for windows NT and the version of the oracle database is Oracle9i Enterprise Edition Release 9.2.0.8.0.

0
rean
6/18/2008 6:49:33 PM

Hi,

 It may be your intent to use 9.2 odp, but your exception stack shows

Oracle.DataAccess.Client.OracleException, Oracle.DataAccess, Version=2.102.2.20

You're using 2.x framework so need to be at a minumum of 10.2.0.2.20 ODP which is the first version of ODP to support .NET2.x, and System.Transactions which is also in the stack.  As stated previously, 10.2 odp requires a 10.2 client as well.

You need to find out what the software requirements are for the app you're using.  You cant use an ODP/client older than what the software was compiled with.  Based on what I see in the exception message, you should be using at least 10.2.0.2.20

Hope it helps,
Greg

0
greg
6/18/2008 7:11:00 PM

i guess what you are trying to say here is that i have downloaded the wrong version of ODP.Net for my application.

greg would you be patient enough to tell me what kind provider is suitable for oracle 9i, i know for sure that the database this application is using is version 9i.

below is the stack trace of the application without installing the odp.net

'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\119f93fc\dba56554\App_Web_WebaApplication2.aspx.cdcab7d2.aif6rsrg.dll', Symbols loaded.'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualBasic\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.A first chance exception of type 'System.TypeInitializationException' occurred in WebApplication2.DLLThe program '[5848] WebDev.WebServer.EXE: Managed' has exited with code 0 (0x0).since both app with ODP.Net and without ODP.net had one common error "

A first chance exception of type 'System.TypeInitializationException' occurred in WebApplication2.DLL" i thght it was the problem with the provider.

really appreciate your replies.

 

thanks in advance.

0
rean
6/19/2008 7:06:52 PM

greg,

thankyou for your tip, your hint got me thinking about doing some research on the System.Data.OracleClient namespace.

I replaced the odp.net namespaces Oracle.DataAccess.Client and Oracle.DataAccess.Types  with that of System.Data.OracleClient and it started to work.

I guess the System.Data.OracleClient didnt work previously becoz it was version 1.0.3300.0 and im guessing that when i downlaoded odp.net it must have downlaoded the System.Data.OracleClient version 2.0. so may be that did the trick.

but thankyou for your valuable input, it helped me a lot.

0
rean
6/19/2008 8:55:45 PM
Reply:

Similar Artilces:

BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined
Could someone please help me in tracing the error, "BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined". I added the reference too,but still getting the same error Am using windows 2003, IIS 6.0 My Code: <%@ Page Language="VB" %> <%@ Import Namespace="System.Data"%> <%@ import Namespace="Oracle.DataAccess.Client" %> <%@ import Namespace="Oracle.DataAccess.types" %> <script runat="server"> Private Sub Page_Load(sender As Object, e As EventArgs) ...

BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined.
Could someone assist me in tracing the error : BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined. I add the reference also but still getting the same error. Am using Windows 2003, IIS 6.0 My code is : <%@ Page Language="VB" %> <%@ Import Namespace="System.Data"%> <%@ import Namespace="Oracle.DataAccess.Client" %> <%@ import Namespace="Oracle.DataAccess.types" %> <script runat="server"> Private Sub Page_Load(sender As Object, e As EventArgs) ' Insert page ...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

The type initializer for 'tags' threw an exception??
Hello I get the following error...  The type initializer for 'tags' threw an exception. Does anyone who what this mean, or what might be causing this? Heres the code on the page giving the error...protected void Page_Load(object sender, EventArgs e) { WebUsers user = new WebUsers(); if (!this.IsPostBack) { if (Session["user"] != null) { user = (WebUsers)Session["user"]; } else { Response.Redirect("Login.aspx"); ...

'ds.SqlCacheDependency' threw an exception of type 'System.NotSupportedException'
Hi guys, As a follow up on my previous question: http://forums.asp.net/t/1336003.aspx I would like to know if any of you have an answer to the problem with the SqlCacheDependency throwing an System.NotSupportedException when trying to update using an AccessDataSource? Thanks :) /Ole   Since the SqlCacheDependency is not supported by Access, any attempt to make use of it through an AccessDataSource control will result in a NotSupportedException: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.accessdatasource.sqlcachedependency.aspx.  The mystery is why ...

Error: Can't load '/cygdrive/c/Oracle/Ora81/bin/Oracle' for module DBD::Oracle...
------_=_NextPart_001_01C4BD25.2E53B509 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C4BD25.2E53B509" ------_=_NextPart_002_01C4BD25.2E53B509 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi guys, =20 Here is what's going on:=20 =20 1. I am running the latest release of CygWin on a Windows XP machine. I am not running ActiveState Perl. 2. I installed DBI and tested it. Looks like it's working fine. I typed: =20 perl -MDBI -e 0 =20 at the ...

Length = 'requestStream.Length' threw an exception of type 'System.NotSupportedException'
 I cannot figure out why when I expand the requestStream variable that I see that error.  Here's my code:   ... request.Timeout = 30000; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; // write data to stream byte[] requestBytes = Encoding.UTF8.GetBytes(request.ToString()); using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(reque...

TypeInitializationException: The type initializer for 'clGeneral' threw an exception.
Okay Here is what I did, I have done this 2 previous projects and it worked flawlessly.  It works on my local machine, but when I deploy it throws the above exception.  this project and the last project are hosted by the same company and are set-up the same (I think - default) I have a seperate class called clGeneral located in teh app_code directory. the clSecured is also located there.  The first class is nothing more than defining common variables like database connections and things like that.  The second I use to encode and decode items that I want to stor...

The type initializer for 'BLL.Customer' threw an exception.
What does this error mean??? No clue.........   In .NET, you can have instance constructors and you can also have a static constructor. The static constructor is used to initialize static variables or do other one-time setup for all instances of a class, usually. Static constructors are also called type initializers, and will be called before the first instance of the class is constructed (it appears to usually happen when you first call a method that needs to know about the type). To see the code that is throwing an exception, look at the code for the class mentioned. In C#, look f...

Unit test causes exception "The type initializer for 'XXX' threw an exception" when running code which accesses appSettings of the webconfig
I have a method which I want to unit test, the code inside that method accesses the appSetting to get the connectionString : System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString(); this piece of code works fine , but when  I m doing the unit test to test the method, the above line gives the below exception :MyMethod threw exception:  System.TypeInitializationException: The type initializer for 'XXX' threw an exception. --->  System.NullReferenceException: Object reference not set to an instance of an object..  ...

The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
I get this stacktrace at my ExceptionManager. It is caught in the Global.asax, so the exception is unhandled by my code :( We have many visitors and customers. This error occurs at least once a week, and all websites in the same pool are down. Only solution for now is to reset the pool when the error occurs. I know there are more topics on this, and I know MicroSoft is aware of the bug but does not know what to do about it. The bug will still be in the 3.5 release. If anybody has a work around for the fix, or a solution which is acceptable and avoids my customers and visitors ...

'Oracle.DataAccess.Client.OracleCommand.Transaction' cannot be assigned to -- it is read only
Hi,  We are converting our existing data access code for Oracle Database. And For methods which are envolved with Transaction I am getting following error.  command.Transaction = this._sqlTransaction;  Error:  Property or indexer 'Oracle.DataAccess.Client.OracleCommand.Transaction' cannot be assigned to -- it is read only Urgently Help Required. Thanks.  Vishal Could you please post more code showing details of   this._sqlTransaction  ? What is it and how is it created?Regards,PrashantDont forget to click "Mark as Answer" on the ...

The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Hi,All of a sudden I started getting this nasty exception all over the place:The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. Some relevant observations:* The error started occuring a few hours after the last deployment to the live server, not immediately after. So it basically started occuring of its own accord.* We have recently moved to a new host (a VPS). The error only occurs on that server, not our local server nor at the old host's (which was a shared environment).* The problem is basically the same as this guys:http://w...

'Sybase.Data.AseClient.AseConnection.DriverVersion' threw an exception of type 'System.TypeInitializationException'
'Sybase.Data.AseClient.AseConnection.DriverVersion' threw an exception of type 'System.TypeInitializationException' This is an error which I am getting while instantiating AseConnection. Can I get help on this exception. I am using C# in Visual Studio 2005. I checked the version in the C:\Program Files\Sybase\OC12_5_1\ADO.NET\dll folder of Sybase.Data.AseClient.dll and sybdrvado11.dll and copied these dlls to my application's bin folder. The versions are the same. Still I am getting the above exception. Whats this code look like? Are you sure both DLLs are sa...

Cannot convert type 'type' to 'type'
I am learning all of this, so I am still fresh, so please bear with me :)I have a page that has some txtboxes in it, simple registration form, and I have a button that will save those txt boxes to the db. I am using:- I am using Visual Web Developer 2008 Express Edition- C# When I try to compile the project I get error: Cannot convert type 'System.Web.UI.WebControls' to 'String' This is content of my web.config    <profile> <properties> <add name="FirstName"/> <add name="LasttName"/>...

The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.
Hello,I am using UDB  Database ( IBM DB2 9.1) with ASP.Net. I am inserting data in DB2 database!When I run my web site in Visual Studio 2008, I can connect with db2 database and successfully insert data!But when I deploy my web site locally in my IIS(After creating Virtual Directory) I receive following Error!   The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception. I uninstall/install Db2 Connect server 9.1, so many time but I am unable to find error!Please if you can help me!Thanks! EME Make sure you shut off VS.NET (no devenv.exe in t...

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
Hi, We have an application developed using VS2002 and .NET 2002 Crystal reports. when this application is deployed on Win 2003 32 bit machine  it worked fine, but when deployed on windows 2003 64 bit machine, crystal reports are not opened. Replaced .NET 2002 Crystal reports with crystal reports 11. Problem still persists. It is giving exception as "The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.".   Can anyone help me on this.   Hi there, Me too, I encounter the same problem....

The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.
This is the error I receive when I try to Build my website. The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception. My website was created using the IIS on localhost option and that is how I open it. If select View In Browser for any page, I receive the following HTML response: Server Error in '/websiteX' Application. Mutex could not be created. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception ...

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
 Hi all,When i run my project on my own computer, it works fine. But when i deploy it to server, it gives me this error. I can run my other dts and sp, but i get this error on this.. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. I googled it but could not find a solution. How can i solve this problem?  Hello sourvil, I'm not sure what the problem is. The following thread explains how you can find out more about the error that is reported: http://blogs.infosupport.com/martijnb/archive/2006/01/27/3582.aspx Jeroen Molenaar.----...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

Parser Error Message: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
Hi When i create my code which uses AutoComplete feature of AJAX ToolKit, everything works fine, but when i deploy the same in our development server, error as below occurs. i have searched lots in net, but in vain.Even forumns doesnt help me on this much.Any clue as to why is this occuring and how to solve it? Any pointers regarding this would be of great help.  Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser...

'Oracle.DataAccess' could not be loaded.
Hi,I have loaded my web application on my web server. I am using Oracle Database and I have also installed ODP.Net on my server, but every time I try to connect to the database I get this error,  File or assembly name Oracle.DataAccess, or one of its dependencies, was not found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: File or assembly name Oracle.DataAccess, or one of its depend...

E2.0
 I am recieving the following error when I attempt to handel an exception.  within a try/catch block I am throwing a simple exception to make sure I setup error checking correctly.  When the error is caught and passed to the block I get this error. try { throw new Exception("test error logging"); //... status = Status.Success; } catch (Exception e) { ExceptionPolicy.HandleException(e, "Report Exception Policy"); status = Status.Fail; }   This is what I have done so far:Downloaded EntLib 2.0Executed .exe downloadRun Build Enter...

Web resources about - The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception - asp.net.oracle

Resources last updated: 2/17/2016 2:05:07 PM