Hi Devart Team,
I have Delphi 2006 .NET with ODAC Components v5.80.0.40.
When i connect my TOraSession from a thread the application crash with exception:
System.InvalidCastException
'QueryInterface for interface CoreLab.Dac.IDBMonitor failed.'
Without a thread it works great.
thanks
Greg
[Resolved] TOraSQLMonitor & Thread
[Resolved] TOraSQLMonitor & Thread
Last edited by yousky on Tue 17 Feb 2009 10:33, edited 1 time in total.
I found a wait to avoid that problem by desactivate temporary the SQLMonitor during Session opening and reactivate it just after session opened.
After testing, it working not, during sql request in my thread, if I open a new request in my waiting part of code in my application, I still have this exception
After testing, it working not, during sql request in my thread, if I open a new request in my waiting part of code in my application, I still have this exception
ODAC passes information to DBMonitor using a COM object. .Net applications have STAThread attribute by default. This attribute does not allow using the COM object from other threads. If you remove this attribute, the TOraSQLMonitor component works from any thread.
To remove the attribute, you need to open the project source and find [STAThread] line before 'begin' line.
To remove the attribute, you need to open the project source and find [STAThread] line before 'begin' line.