Atozed Forums
FireDac in Isapi.dll - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: FireDac in Isapi.dll (/thread-1375.html)



FireDac in Isapi.dll - Mikael Nilsson - 11-11-2019

IW 15.1.7

I have recently converted  DBExpress to FireDac in my web application.
Now almost every day the web application and my datasnap application freezes
and I have to stop start the web pools.


Today I remembered this:

"FireDAC is thread-safe, when the following conditions are meat:
A connection object and all associated with it objects (like TFDQuery, TFDTransaction, etc) in
each moment of time must be used by a single thread. FDManager must be activated before
threads will start by setting FDManager.Active to True."


Is it relevant in a ISAPI.dll? If so where do I put the code?

I have also attached a log message from my Isapi.dll witch I think is causing the problem
[attachment=190]


RE: FireDac in Isapi.dll - kudzu - 11-11-2019

Yes its very relevant. All IW apps no matter the deployment method are threaded.

You need one per thread. You can use the UserSession or a datamodule that belongs to the usersession.


RE: FireDac in Isapi.dll - Mikael Nilsson - 11-11-2019

Ok bad news. Why did I changed to FireDac???

But isn't a thread already started when creating UserSession.
So what about this statement? FDManager must be activated before threads will start by setting FDManager.Active to True.

This is how I did it in a Service module
  FDManager := TFDManager.Create(nil);
  FDManager.ConnectionDefFileName := 'e:\FireDAC\FDConnectionDefs.ini';
  FDManager.ConnectionDefFileAutoLoad := True;
  FDManager.Active := True;

  StartThreads;  { Start file threads and begin fetching files }



Is that code ok, if so where should I put it. CreateUserSession?


RE: FireDac in Isapi.dll - Mikael Nilsson - 11-11-2019

Hi,

I just tested to drop a FDManager component on UserSession form.
It looked ok I tested several querys. But when I did Logoff  I got this error

Error message: [FireDAC][Comp][Clnt]-500. Application must have only single FDManager