XData and AureliusConnection -> AccessViolation


I am trying to get an XData console application with Aurelius database connection running,
but when I am calling the URL of a database table published by XData Server in m browser
I am getting an AccessViolation exception.

First of all, it should be said, that I my XData service application in principle is running.
I have also created a client which is able to get data which I am requesting from the server
via JSON objects.

So, for debugging purposes I made a new "TMS XData Server Application" with the wizard,
as descibed in the tutorial of Holger Flick, and selected "console" application.
I used the default server settings (http://+:2001/tms/data) and selected Native SQLite
(my real application uses MSSQL, but for testing it's easier using this type of database,
and I also got the error with MSSQL).

After the wizard created the application I only made two changes:

  1. "In ConnectionModule.pas" -> "AureliusConnection1" -> "Connection settings"
    I selected the database file which I have created before. It only contains one table "Users".
    with two fields, while one of the fields is also the primary index. "Test Connection" said
    "Connection established successfully".

  2. I generated the entities for the database with the assistant and selected my "Users" table.

Now I compiled the project and started the server, which is working as expected.

So I opened my browser and the URL http://localhost:2001/tms/xdata/$model to see whether my
XData server is publishing the database objects. The $model looked as expected: my database
table and both of the fields of the table are visible.

But when I am calling http://localhost:2001/tms/xdata/Users (where "Users" is the name of
the table as shown in the $model) I am getting back this error message:

"error": {
"code": "AccessViolation",
"message": "Zugriffsverletzung bei Adresse 00601534 in Modul 'Console_XData_Server.exe'. Lesen von Adresse 00000068"

Do you have any ideas what's going wrong?
I am using Delphi 10.4.2 Sydney and TMS with latest patches.

Here is the result of $model:

"Title": "Server API",
"Version": "3",
"Schemas": [
"Namespace": "XData.Default",
"EntityTypes": [
"Name": "Users",
"Properties": [
"Name": "UserID",
"Required": true,
"Length": 3,
"Type": "String"
"Name": "UserFullname",
"Length": 50,
"Type": "String"
"NavigationProperties": [],
"Key": [
"EntityContainers": [
"Name": "Default",
"EntitySets": [
"Name": "Users",
"EntityType": "Users"
"EnumTypes": [],
"InstanceTypes": [],
"Controllers": []

Best regards,

Without the exact source code I can only guess, but my guess is that the TDataModule containing the connection components is simply not instantiated. It's normal in a console application, please instantiate the data module manually in the dpr source code before starting the XData server.

Hi Wagner,

maybe I don't understand something in general. This is a part of the code of the interface of ConnectionModule.pas which is defining the class of the connection.

TSQLiteConnection = class(TDataModule)
AureliusConnection1: TAureliusConnection;
class function CreateConnection: IDBConnection;
class function CreateFactory: IDBConnectionFactory;
class function CreatePool(APoolSize: Integer): IDBConnectionPool;

SQLiteConnection: TSQLiteConnection;

Should the declaration of the variable not be enough instantiation? So I added

SQLiteConnection := TSQLiteConnection.create(nil);

in the dpr source code before starting the server, as I have seen this in one of the XData examples (simple_sqlite). Indeed the AccessViolation is gone, but now I can see the table and the fields in $model, but I am getting an empty value back if I am trying to open the table via the URL.

Best regards,

Can you please provide more details? I have you project you send us in private, but I don't have the database, so I'm not sure what do you expect and what the server is exactly returning?

I sent you a download link for our demo database.
What I am expecting is a behaviour like this: https://youtu.be/Brq4lbUqJYM?t=398

I don't see what's wrong? I ran your application and it works fine:

Database has no data in Users table, thus of course it will bring an empty array in the response: