Attempted to read or write protected memory. This is often an indication that other memory is corrup

  • Thread starter Thread starter www.gusse.net
  • Start date Start date
W

www.gusse.net

Have just switch from 1.1 to framework 2.0 and i´m getting this error :

Attempted to read or write protected memory. This is often an indication
that other memory is corrupt

anyone have a clu why ?

happens inside this :

public bool ExecSql(string sql)

{

bool ReturnValue = false;

OpenConnection();

OleDbCommand myCommand = new OleDbCommand(sql,oDatabaseConnection);


try

{

try

{

log.Debug("[ExecSql] SQL (ExecuteNonQuery): " + sql);


//OleDbTransaction myTrans =
oDatabaseConnection.BeginTransaction(IsolationLevel.ReadCommitted);

if (myTrans!=null)

myCommand.Transaction = myTrans;

myCommand.ExecuteNonQuery();

//myTrans.Commit();

ReturnValue = true;

}

catch (Exception ex)

{

log.Error("[ExecSql] Fatal error : " + ex.Message + " - " + sql);

}

}

finally

{

GC.Collect();

GC.WaitForPendingFinalizers();


}

return ReturnValue;

}
 
yes it work,..

it all works in 1.1 framework and i have not changed one line of code..

very strange..
 
I'm having a very similar problem talking to Oracle after .net 2.0 conversion
(Description below), it only hapens on one developer machine and our
development server though. Most developer machines are fine. Have you had any
luck solving your problem?

I'm trying to read data using a command object within .net 2.0. most of our
developer machines are working fine. However one developer machine, and the
dev server are coming up with the following exception when i try and connect
to oracle and do anything.



at Oracle.DataAccess.Client.OpsSql.ExecuteReader(IntPtr opsConCtx,
IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr opsSubscrCtx, Int32&
isSubscrRegistered, OpoSqlValCtx*& pOpoSqlValCtx, OpoSqlRefCtx&
pOpoSqlRefCtx, IntPtr[] pOpoPrmValCtx, OpoPrmRefCtx[] pOpoPrmRefCtx,
OpoMetValCtx*& pOpoMetValCtx, Int32 NoOfParams)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery,
Boolean fillRequest, CommandBehavior behavior)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
at ConsoleAppTest.Class1.authenticateLogin(String username, String
password) in C:\Inetpub\wwwroot\ConsoleAppTest\Class1.cs:line 210

Oracle.DataAccess

Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.

System.AccessViolationException

Int32 ExecuteReader(IntPtr, IntPtr ByRef, IntPtr ByRef, IntPtr, Int32 ByRef,
Oracle.DataAccess.Client.OpoSqlValCtx* ByRef,
Oracle.DataAccess.Client.OpoSqlRefCtx ByRef, IntPtr[],
Oracle.DataAccess.Client.OpoPrmRefCtx[],
Oracle.DataAccess.Client.OpoMetValCtx* ByRef, Int32)

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at Oracle.DataAccess.Client.OpsSql.ExecuteReader(IntPtr opsConCtx,
IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr opsSubscrCtx, Int32&
isSubscrRegistered, OpoSqlValCtx*& pOpoSqlValCtx, OpoSqlRefCtx&
pOpoSqlRefCtx, IntPtr[] pOpoPrmValCtx, OpoPrmRefCtx[] pOpoPrmRefCtx,
OpoMetValCtx*& pOpoMetValCtx, Int32 NoOfParams)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery,
Boolean fillRequest, CommandBehavior behavior)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
at ConsoleAppTest.Class1.authenticateLogin(String username, String
password) in C:\Inetpub\wwwroot\ConsoleAppTest\Class1.cs:line 210

I've read alot of people with the problem, but no solutions seem to be out
there.

Has anyone had this problem? and if so why? I cant find anyway arround it.
The code we are running is dirt simple. "select userID from
HCD02.tblUserLoginCredentials where username = :username and password =
:password" and it works on .net 1.1 but not on .net 2.0? however it does work
on .net 2.0 on most of our developer machines.
 
Remove Comments

I struggled with this problem for a long time but finally landed on the problem, at least in my particular case. Remove all Comments from the query you are trying to execute.
 
hngeno said:
I struggled with this problem for a long time but finally landed on the problem, at least in my particular case. Remove all Comments from the query you are trying to execute.
Could you please tell me what you mean by saying "Remove all Comments"?
Do you mean remove syntax like ', " or () ??

Please explain.
 
Attempted to read or write protected memory. IBM Db2

I ran into similar problem but after too much research I found out that problem was something very different. I had set the Impersonation = true in web.config and IBM Db2 on my windows 2003 server didnt have permissions for all users. I just set it to false (or remove it) and my application started working.



I hope this helps..
 
I ran into similar problem but after too much research I found out that problem was something very different. I had set the Impersonation = true in web.config and IBM Db2 on my windows 2003 server didnt have permissions for all users. I just set it to false (or remove it) and my application started working.



I hope this helps..
 
Back
Top