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

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;

}
 
W

www.gusse.net

yes it work,..

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

very strange..
 
G

Guest

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.
 
Joined
Dec 6, 2007
Messages
1
Reaction score
0
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.
 
Joined
Mar 23, 2008
Messages
1
Reaction score
0
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.
 
Joined
Sep 7, 2009
Messages
2
Reaction score
0
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..
 
Joined
Sep 7, 2009
Messages
2
Reaction score
0
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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top