timing race with dcom

dlstites

Member²
I have a service application with many DOA
components running as a dcom service provider.

I connect through TDCOMconnect for TClientDatasets.

for the most part, it works great, servicing 50 users, however at least once a day, I get the message ... "oracle session undefined" or "Cannot preform operation on closed dataset".

When the connection is preformed, a new thread is created and a new Oracle session opened for that thread.
I believe it is a simple timing race. I have put in a test on the event "afterconnect" of the TDCOMconnect control which will keep issuing a simple query to return 0 rows. If it fails, wait 2 seconds. then try again.

Does anyone have a better idea of what's going on or a more elegant way to solve problem?

thanks in advance.
doug
 
Instead of running a query use TOracleSession.CheckConnection in a timer event. If the session has lost its database connection your TOracleDataSet and TOracleQuery components will be closed. If the connection is lost reconnect and instantiate components.
 
The problem with TOracleSession.CheckConnect is that the client checking has no access to that component. The client only see's the DCOMconnect component, and that is where the failure occurs.
 
The exception "Oracle session undefined" indicates that a Direct Oracle Access component that has a Session property (most of them do) is being accessed (opened, executed, ...) when this property is nil. This should of course never be the case, but it can happen if the session has been freed, or (obviously) when the Session property has explicitly been set to nil.

Could this be the case?

------------------
Marco Kalter
Allround Automations
 
Back
Top