Read or write attempt in protected memory

Asked

Viewed 10,059 times

2

I have an application in C# connecting to the database Oracle. For this the application makes use of the Nhibernate (a very old version) and Castle Activerecord. This always worked, however, now when I try to make some consultation at the bank I get a System.Acessviolationexception, what it says:

Read or write attempt on protected memory. Usually, this is an indication that another memory is damaged.

The intriguing thing is that on all the other computers here, everything works perfectly. I have seen a lot about it in the last few days, but nothing has helped me to solve it. Even I searched for the error in English:

Attempted to read or write protected memory. This is often an Indication that other memory is Corrupt.

and I ended up meeting other people who had this problem with the Nhibernate and/or Activerecord. Unfortunately update the Nhibernate or stop using the Activerecord is not a valid option. I am sure that this error is not specific to those libs, but I can’t find a solution to this.

The stacktrace of the first exception is:

em System.Data.Common.UnsafeNativeMethods.OCIServerAttach(OciHandle srvhp, OciHandle errhp, Byte[] dblink, Int32 dblink_len, MODE mode)
   em System.Data.OracleClient.TracedNativeMethods.OCIServerAttach(OciHandle srvhp, OciHandle errhp, String dblink, Int32 dblink_len, MODE mode)
   em System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
   em System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
   em System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   em System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   em System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   em System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   em System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   em System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   em System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   em System.Data.OracleClient.OracleConnection.Open()
   em NHibernate.Connection.DriverConnectionProvider.GetConnection()

EDIT

I uninstalled the Oracle I had on my machine and now I’m getting the error:

System.Data.Oracleclient requires Oracle client software version 8.1.7 or later.

I’ve reinstalled the Instant Client and the other design that makes the same connections is working normal...

  • Try reinstalling the oracle client. I’ve been there and the problem was this.

  • I’m going to do this right now, it’s kind of weird because I have another application like this in this connection with the bank and this second one is working.

  • You may be trying to perform a task that is not supported by the App or driver. This error occurs when a program attempts to access a memory reference that is not from it.

  • @Joãoluizgrigolettin, now I’m simply trying to open the connection with System.Data.Oracleclient.Oracleconnection and I’m getting this error.

  • The last exception may not be where the problem resides, it may be a consequence of a previous error. Rest assured of this.

  • @lsalamon, I said last wanting to say the first. In case, the last Innerexception

Show 1 more comment

2 answers

5


I’m going to record here how I solved this problem, in case anyone comes across the same.

This first error was caused by I was using a local x64 database and my Instant client was x86. I was not using the local bank, but anyway I decided to uninstall bank. The second error was because my user was without read/write permission in the folder of Instant client, then what I needed to do was give these permissions to my user and restart the PC.

-1

Hello, recently I was having the same problem, a batch of execution worked very well and in the next batch the error appeared, on the way I realized my mistakes, where both generated the situation, the causes are:

• Create from one Command from another Command var comandOracle = _comando • Number of parameters other than target base (in my case of Insert)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.