0

My pc windows 2012 server, 64 bit and oracle 12 c client is 32 bit. I am also using IIS. All options are done. I can access my web applications and getting data from database.

However, when I try to add something to database, it is giving error. It is not about tnsnames, connectionstring. The error is:

Exception Details: Oracle.DataAccess.Client.OracleException: 

Source Error: 
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.  

Stack Trace: 
[OracleException (0x80004005)] Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable) +1508 
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) +51 
Oracle.DataAccess.Client.OracleConnection.Open() +5235 
BMS.WebForm1.Button1_Click(Object sender, EventArgs e) +92 
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9615682 
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Here is the Connection code

 using Oracle.DataAccess.Client; 
 . . . . .
 string oradb = "DATA SOURCE=bms;PASSWORD=training;USER ID=training;";
 OracleConnection con = new OracleConnection(oradb); 
 con.Open();
 MyMessageBox("connected!"); 
 con.Close(); 
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    This may be a 32-bit/64-bit issue. I suggest [looking at this answer](http://stackoverflow.com/questions/20646800/oracleexception-0x80004005-when-connecting-to-oracle-database). Best of luck. – Bob Jarvis - Слава Україні Jan 24 '15 at 15:04
  • Sounds like you not getting your Oracle connection opened right – T.S. Jan 24 '15 at 20:23
  • @T.S. I am getting data from database in my webapplication. however i can not send any şnsert request into it. I tested twice, connection does not open. i dont know why. –  Jan 24 '15 at 22:08
  • @BobJarvis mine is 64 bit computer but i installed 32-bit 12c oracle client with odp.net. –  Jan 24 '15 at 22:32
  • This is not format issue. If you had 32/64 issue, exception would say "incorrect format". Your code breaks here `Oracle.DataAccess.Client.OracleConnection.Open()`. It tells me that your connection object is not initialized correctly on tht specific call. You getting data - good. But you can't insert. [lets imagine for a minute] - you open connection, get data using that connection and then, without closing it call `Open` again - probably the case. May be you show us how your `select` is coded. – T.S. Jan 24 '15 at 23:54
  • @T.S. Thanks for answering. I just created a blank web page with a button. I am using IIS by the way. This web app works on 64 bit windows 8 and does not work on windows 7 and windows 2012 server both are 64 bit. Here is the code. Still same error. using Oracle.DataAccess.Client; string oradb = "DATA SOURCE=bms;PASSWORD=training;USER ID=training;"; OracleConnection con = new OracleConnection(oradb); con.Open(); MyMessageBox("connected!"); con.Close(); –  Jan 25 '15 at 08:39
  • If the code you posted above works on one machine but not on another - look for "Oracle client/ODP.NET" compatibility. Most likely, your **Oracle.DataAccess.dll** doesn't match the Oracle Client installed on that machine. If you have Oracle Home directory where you have folder `odp.net\`, go there, go to appropriate version [2.0/4.0] and check the version of dll there and in your bin folder – T.S. Jan 25 '15 at 16:16

0 Answers0