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.
– João Luiz Grigoletti
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.
– Jéf Bueno
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ão Luiz Grigoletti
@Joãoluizgrigolettin, now I’m simply trying to open the connection with System.Data.Oracleclient.Oracleconnection and I’m getting this error.
– Jéf Bueno
The last exception may not be where the problem resides, it may be a consequence of a previous error. Rest assured of this.
– lsalamon
@lsalamon, I said last wanting to say the first. In case, the last Innerexception
– Jéf Bueno