You are not logged in.
Hi,
I got this exception when I try to freeing a TOleDBMSSQL2008ConnectionProperties :
'You should call TOleDBConnection.Free from the same thread which called its Create: i.e. call MyProps.EndCurrentThread from an THttpServerGeneric.OnHttpThreadTerminate event - see ticket 213544b2f5
I saw the ticket but I don't understand what's wrong.
Thnx.
Offline
How do you create the TOleDBMSSQL2008ConnectionProperties instance?
How do you free the TOleDBMSSQL2008ConnectionProperties instance?
It should be on the same thread.
If you use interface-based services, ensure you define properly the threading options for the interface, e.g. opt*InPerInterfaceThread in TServiceFactoryServer options.
Online
aPropsMS := TOleDBMSSQL2008ConnectionProperties.Create('127.0.0.1', 'MSDB', 'sa', '');
and
FreeAndNil(aPropsMS);
All on the same unit.
the create is on the server.create and the freeAndNil on the Server.Destroy.
I don't use the interface-based services.
Last edited by tech (2014-03-10 15:21:19)
Offline
The server is created/freed on the main form and the TOleDBMSSQL is created/freed on the server.
I think they are on the same thread.
Offline
I think they are on the same thread.
If you have an exception about "You should call TOleDBConnection.Free from the same thread which called its Create", I suppose suppose this is not the case.
Online
I've emplemented the Server.HttpServer.OnHttpThreadTerminate notification to call this as indicated :
aPropsMS.EndCurrentThread;
but I got a serious AV
---------------------------
Application Error
---------------------------
Exception EAccessViolation in module project1.exe at 000043B8.
Access violation at address 004043B8 in module 'project1.exe'. Read of address 49776F2E.
---------------------------
OK
---------------------------
I confess that I have trouble understanding how mORMot works.
Thnx,
Offline
In current unstable 1.18 revision, TSQLRestServerStaticExternal.EndCurrentThread will call automagically TOleDBMSSQL2008ConnectionProperties.EndCurrentThread.
So you are not supposed to call it by hand, when using the integrated ORM feature with external tables.
Online
Ok, good news.
Thank you ab.
Offline