Home All Groups Group Topic Archive Search About

Attempted to read or write protected memory

Author
24 Mar 2006 8:12 AM
brian.mills
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.

Author
30 Mar 2006 8:24 AM
giorgio_vaccarino
I have a similar problem connecting to a Pervasive Sql 8.6 server. The
problem is erratical, happens often when I have poor server activity. I
had no help from Pervasive. The problem seems more frequent after the
migration to the 2.0 framework.
I tried many things (included disposing any objects and collect them
with gc) with no success. I'm in despair.

Exception: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
Source: System.Data
   at
System.Data.Common.UnsafeNativeMethods.SQLGetData(OdbcStatementHandle
StatementHandle, UInt16 ColumnNumber, SQL_C TargetType, CNativeBuffer
TargetValue, IntPtr BufferLength, IntPtr& StrLen_or_Ind)
   at System.Data.Odbc.OdbcStatementHandle.GetData(Int32 index, SQL_C
sqlctype, CNativeBuffer buffer, Int32 cb, IntPtr& cbActual)
   at System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype,
Int32 cb, Int32& cbActualOut)
   at System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i)
   at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap
typemap)
   at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i)
   at System.Data.Odbc.OdbcDataReader.GetValues(Object[] values)
   at
System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[]
values)
   at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping
mapping)
   at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset,
DataTable datatable, String srcTable, DataReaderContainer dataReader,
Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn,
Object parentChapterValue)
   at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable)
Author
12 Dec 2006 6:59 AM
amper amper
I same , I have similar problem. I use implement by asp.net , DotNet 2.0
, sybase.

I can not know why to occur . plesase tell me if you know


Exception : System.AccessViolationException

Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
   at System.Data.Common.UnsafeNativeMethods.IRowset.GetData(IntPtr
hRow, IntPtr hAccessor, IntPtr pData)
   at System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()
   at System.Data.OleDb.OleDbDataReader.GetValueBinding(MetaData info)
   at System.Data.OleDb.OleDbDataReader.GetValues(Object[] values)
   at
System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataRea
der.GetValues(Object[] values)
   at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping
mapping)
   at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset,
DataTable datatable, String srcTable, DataReaderContainer dataReader,
Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn,
Object parentChapterValue)
   at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable)

*** Sent via Developersdex http://www.developersdex.com ***

AddThis Social Bookmark Button