Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ODBC Oracle Error

I have a .net App I have been asked to modify, it uses .net framework 2.0

I have setup an ODBC DSN with the connection details for our Oracle DB on my local machine, Tested the connection and it works fine.

Now I ran my application, it went with no problem and finished, I had checked our error log and found a couple of errors unrelated to this issue but this error did not show up.

So I ran the app again with break points in order to get to these errors. This time it crashed with the below error

ERROR [IM004] [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

Now what is getting me on this is that it just ran fine not even 10 minutes ago and I only added a break point.

I have found a few answers and gave them all a shot.

  1. I set the Read/Execute on the oracle driver folder off than on to reset the permissions and it made no difference
  2. I checked the "Path" Environment Variable and it is fine
  3. Using the ODBC Administrator I tested the connection without error.
  4. Verified the connection string pointing to the DSN is still correct 5. List item
  5. Verified my App is setup to run 32 bit as the Driver is 32 bit.

The only thing I have not done is to save, shut restart computer and try again.. Which I will do right after this post, if it works I will post that.

Anyway if anyone has any idea what could cause this behaviour I would be very thankful to you.

Computer is Win7, .net FrameWork is 2.0 , it's VB.net, Oracle Driver is 10g (10.2)

Update: okay I used the ODBC Administrator to remove the DSN and rebuild it. I ran my app and it worked.

I came back later today after no changes and re-ran the application and got the error again. tried to rebuild the DSN and it didn't help, I tried to restart and it didn't help.

Below is the stack trace.

StackTrace:
       at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
       at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
       at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
       at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.Odbc.OdbcConnection.Open()
like image 675
sarchbold Avatar asked Mar 13 '13 14:03

sarchbold


1 Answers

Are you running this on a remote desktop? If so you may have to add "Create Global Objects" for Remote Desktop Users to the Local Policy.

If you're on a local desktop, check the version of the ODBC driver you are running. If it's anything older than 11.2.x.x, you should probably install a newer ODBC driver from Oracle (don't use the Microsoft Oracle ODBC driver - it has problems).

like image 56
ELadner Avatar answered Oct 12 '22 13:10

ELadner