In uniGUI, each TFDConnection component must be placed on MainModule or a DataModule created from uniGUI Wizard. It is also possible to create and destroy a common datamodule as part of the constructor and destructor of any TUniForm (because they are also private to its session). This will ensure that each session will have its own private TFDConnection component.
在uniGUI,每个TFDConnection组件必须放在 MainModule或者 由uniGUI Wizard创建的DataModule里。TFDConnection也可创建和销毁公众 datamodule ,作为 TUniForm(因为他们对Session同样是私有的)的constructor 和destructor 。这将确保每个Session将有它自己私有的TFDConnection组件。
In addition to that, we need to place a TFDManager component on the ServerModule and set its Active property to True in ServerModule's OnCreate event.
另外,要放一个TFDManager组件在ServerModule ,在ServerModule的OnCreate 事件里,设置它的Active 属性为True,。
Other components to place on ServerModule are TFDGUIxWaitCursor and TFDPhysXXXDriverLink. TFDPhysXXXDriverLink is the driver link component for your database engine. For MySQL it should be TFDPhysMySQLDriverLink. For TFDGUIxWaitCursor set Provider to Console and ScreenCursor to gcrNone.
其他要放在ServerModule 里的组件有: TFDGUIxWaitCursor 和TFDPhysXXXDriverLink。TFDPhysXXXDriverLink是根据你的数据库类型来的,例如,MySQL就应该为TFDPhysMySQLDriverLink。将TFDGUIxWaitCursor的Provider 设置为Console ,同时 ScreenCursor 设置为gcrNone.。
In the OnCreate event FDManager1.Active should be set to True.
FDManager1的OnCreate 事件里, FDManager1.Active 应该设置为True.
procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject); begin . . FDManager1.Active := True; end;
In similar manner, in the OnDestroy event FDManager1.Close should be called.
类似地,FDManager1的OnDestroy 事件,FDManager1.Close 应被调用。
procedure TUniServerModule.UniGUIServerModuleDestroy(Sender: TObject); begin . . . FDManager1.Close; end;
Pooling Connections 连接池
One of the advanced features in FireDAC is the support for pooled connections. It allows sharing identical database connections among sessions.
FireDAC 的一个高级特色,就是它支持连接池。它允许在多个会话里,共用同一个数据库连接
文章来源: 博客园
- 还没有人评论,欢迎说说您的想法!