xdata server apache + linux

Cannot get work the xdata apache module for other db conenctions than sqlite (from the example)

initialization
  Server := TWebBrokerServer.Create;
  //---------------------------------------------------
  TDatabaseManager.Update(TUniDacMySqlConnection.CreateConnection);
  Server.Dispatcher.AddModule(TXDataServerModule.Create(
    'http://xdata.mycloud.si/tms/xdata', TUniDacMySqlConnection.CreateConnection
  ));
  // add modules you want to use. This example assumes a simple Sparkle module,
  // but you can add your XData, RemoteDB or any other Sparkle module
  Server.Dispatcher.AddModule(TAnonymousServerModule.Create(
    'http://xdata.mycloud.si/tms/hello',
    procedure(const C: THttpServerContext)
    begin
      C.Response.StatusCode := 200;
      C.Response.ContentType := 'text/plain';
      C.Response.Close(TEncoding.UTF8.GetBytes('Hello from Sparkle!'));
    end
  ));
finalization
  Server.Free;

I m using unidac, and the unidac connection tester is working well under linux console,but when used in the example crashes (even without entities), have tried all kinds of database connection (Firedac, MSSQL Native) but none seems to work...

Any example would be the best.

Hello Dino,

Make sure you create the UniDacMySqlConnection data module and destroy it at the end:



initialization
  UniDacMySqlConnection := TUniDacMySqlConnection.Create(nil);
  Server := TWebBrokerServer.Create;
  //---------------------------------------------------
  TDatabaseManager.Update(TUniDacMySqlConnection.CreateConnection);
  Server.Dispatcher.AddModule(TXDataServerModule.Create(
    'http://xdata.mycloud.si/tms/xdata', TUniDacMySqlConnection.CreateConnection
  ));
  // add modules you want to use. This example assumes a simple Sparkle module,
  // but you can add your XData, RemoteDB or any other Sparkle module
  Server.Dispatcher.AddModule(TAnonymousServerModule.Create(
    'http://xdata.mycloud.si/tms/hello',
    procedure(const C: THttpServerContext)
    begin
      C.Response.StatusCode := 200;
      C.Response.ContentType := 'text/plain';
      C.Response.Close(TEncoding.UTF8.GetBytes('Hello from Sparkle!'));
    end
  ));
finalization
  Server.Free;
  UniDacMySqlConnection.Free;
end;

Tried even with this, recieive always a garbled module response from apache.

In the meantime I have replaced the apache solution with a linux console application using the Indy based server, like in:

http://www.tmssoftware.biz/business/sparkle/doc/web/indy-based-server.html

Indy-based server is a valid and simpler alternative, yes. But what is the garbled module response you get? I understand the error message changed, then?

Hi to me it sounds like a problem with the mysql lib not found by your apache module.
Did you try to copy libmysql.so in the folder containing your module DLL ?