Jump to content
Sign in to follow this  
Stuart Clennett

How to add FireDAC Datamodule as per the demo?

Recommended Posts

Hi Andrea,


I am trying to add a new datamodule to my MARS server that supports the FireDAC functions but the resource is not being included in the server app along with the others.


I have inspected your "FireDAC Basic Demo" and I did the following:


• Added MARS.Data.FireDAC.DataModule to my server project from the MARS\Source directory

• Created a new DataModule by inheriting from that unit

• Added the MARS units to the uses clause, as per your demo

• Added the Path attribute

• Added the Initialization section to add the datamodule to the MARSResourceRegistry.Instance


However, on running the server I cannot see the resource listed in the treeview and it is not recognised when I try to access through the client.


Is there something I have missed?



The full datamodule source code is here:


unit server.fddata;


  System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf,
  FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.IB, FireDAC.Phys.IBDef, FireDAC.VCLUI.Wait, FireDAC.Stan.Param,
  FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client
  , MARS.Data.FireDAC.DataModule
  , MARS.Core.Attributes
  , MARS.Core.URL
  , MARS.Core.Token  ;


  TFDData = class(TMARSFDDataModuleResource)
    EmployeeConnection: TFDConnection;
    EmployeeTable: TFDQuery;


{%CLASSGROUP 'Vcl.Controls.TControl'}


{$R *.dfm}




Share this post

Link to post



Have you made sure that your unit is listed under uses and included in the filter that is specified in the AddApplication procedure?


    FEngine.AddApplication('DefaultApp', '/default', [ 'Server.*']);




  • Like 1
  • Thanks 1

Share this post

Link to post

Hi Bjørn,


Yes, that was the missing piece of the jigsaw.


I needed to add the server.fddata unit to the uses clause of server.ignite,  and also the AddApplication filter was 'server.resources.*' which I have changed to 'server.*'


My data resource appears in the list now.


Many thanks

  • Like 1

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this