UpdateDatabase fails with "insufficient privileges"

I have a Sphinx project, which has all the usual components - Sparkle, Aurelius, connection and creates the DB tables in an Oracle DB. I wanted to add some REST logic services and I wanted those to piggy-back on Aurelius and store some extra data. So, I have added XData server + service and that part works, then I have added another unit with a new entity class, using Data Modeller, I have given it a Model Name, then I have added that same model name to the existing AureliusDBSchema object in the original Sphinx data module, after a ","-comma - not sure it was necessary, registered entity and ran it - this actually does create a new table Ok during the AureliusDBSchema1.UpdateDatabase call, but then it mysteriously trying to execute a TFDQuery with an empty SQL that raises an exception "Ora: insufficient privileges".

The background is that I'm using RSA256 JWT signatures and I wanted to generate the keys programmatically at run-time, store them in a table, rotating as needed, and serve them through a public URL through XData in JSON format, similar to how Okta & Azure do it.

What did I do wrong? There's a lot of magic happening under the hood, so I cannot see if I could reuse the existing DB connection used by Sphinx, reuse existing Aurelius stuff already there, etc.

It really should not be a DB issue here, because 1) the table does get created and 2) I can run SQL against it under the same DB account. Although maybe it's trying to create some additional stuff after that, like a constraint, which could fail? But the SQL in the debugger is empty, so probably it's something else...

Ok, found it: it was trying to create a sequence and this user did not have permissions. Granted and it was solved.

Not sure why it needed a sequence, though. And not sure why Data Modeller has generated so many classes, not just the one for the entity.

So now, I have these classes:
TRSA_KEYS, TDicDictionary, TRSA_KEYSTableDictionary and a function Dic: TDicDictionary;

Does it mean I can access the data through "Dic" directly? Or do I still need to add and use AureliusManager & AureliusDataset? - I need to be able to read existing data, all fields, delete and insert rows and set values, etc.

Getting there slowly. I'm now getting:

First chance exception at $00007FFA9E432CDC. Exception class EIdNotSetException with message 'Id not set on entity of class TRSA_KEYS.'...

The class def generated by the Modeller is:
[Entity, Automapping]
[Model('ESI.JWTRSA')]
[Table('RSA_KEYS')]
[Id('FISS', TIdGenerator.None)]
TRSA_KEYS = class
private
[Column('ISS', [TColumnProp.Required])]
FISS: TDateTime;
[...]

I have this column set up with a default SYSDATE value, so it would be populated by Oracle automatically.

What should it be to get past this error?

Probably because your entity class has associations to other classes?

I'm not sure if I understand your exact question here. All Aurelius data is always retrieved through a TObjectManager object, but of course there are variations.

First, the dictionary is a helper for you to create Aurelius queries. It's explained here and here.

AureliusDataset doesn't retrieve any data, it's simply a view-side tool that you can use to bind Aurelius objects to visual data-aware controls.

You can't have that. Aurelius doesn't have a way to retrieve the data you have just inserted, or properly uniquely identify the object at client-side.

In this case I would just use an opaque id, either an integer generated server-side (identity generator) or a guid generated client-side (guid/uuid generators).

Ok, great, thanks: I have deleted all the Dictionary classes Modeller has created, reshuffled the data, added generator and it started working ;-)

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.