#1 Re: mORMot 1 » MSSQL Server Index problem » 2022-03-08 16:07:15

I use
TOleDBMSSQLConnectionProperties

What specific drivers does mormot use for this?

Is it about these?

https://docs.microsoft.com/pl-pl/sql/co … erver-2017

#2 Re: mORMot 1 » MSSQL Server Index problem » 2022-03-08 12:45:56

202 / 5 000
Wyniki tłumaczenia
This is probably not a problem with the index.
I feel a bit in the dark because the problem does not exist for me, but it does occur in the workplace.
I made a log and the server goes out at
CreateMissingTables
showing

20220308 12294943 EXC   EOleSysError 80040154 ("Class not registered") [] at 5662b5  stack trace API 6df464 6df48c 40b828
20220308 12294943 EXC   EOleSysError 80040154 ("Class not registered") [] at 5662b5  stack trace API 6df464 6df48c 40b828
20220308 12294943 EXC   EOleSysError 80040154 ("Class not registered") [] at 5662b5  stack trace API 6df464 6df48c 40b6a0 77da88b4 77d94ee6 5662b5 7f5823 a39871 7e4e72 7e5537 7e7615 7e6e6a 7eaf66 a3caea 9c0005 9c0500 7b939e 9bd882 9689c5 968c3a 94d4a4 959f04 97992f 97a1bc 97ac68 95d019 95d16e 95d287 90bf18 9081fe
20220308 12294943 EXC   EOleSysError 80040154 ("Class not registered") [] at 5662b5  stack trace API 6df464 6df48c 40b6a0 77da88b4 77d94ee6 5662b5 7f5823 a39871 7e4e72 7e5537 7e7615 7e6e6a 7eaf66 a3caea 9c0005 9c0500 7b939e 9bd882 9689c5 968c3a 94d4a4 959f04 97992f 97a1bc 97ac68 95d019 95d16e 95d287 90bf18 9081fe
20220308 12294943 EXC   EOleSysError 80040154 ("Class not registered") [] at 5662b5  stack trace API 6df464 6df48c 40b828
20220308 12294943 EXC   ESQLite3Exception {"ErrorCode":1,"SQLite3ErrorCode":"secERROR","Message":"Error SQLITE_ERROR (1) [PRAGMA table_info(Users);] using 3.31.0 - Class not registered, extended_errcode=1"} [] at 90c886  stack trace API 6df464 6df48c 40b828
20220308 12294943 EXC   ESQLite3Exception {"ErrorCode":1,"SQLite3ErrorCode":"secERROR","Message":"Error SQLITE_ERROR (1) [PRAGMA table_info(Users);] using 3.31.0 - Class not registered, extended_errcode=1"} [] at 90c886  stack trace API 6df464 6df48c 40b6a0 77da88b4 77d94ee6 90c886 90bf86 9081fe 9b8d47 a6df48 625c9f 625877 625826 631379 a7ded2 76c3fa29 77d87a9e 77d87a6e

What should I look for next?

After I commented CreateMissingTables

I am getting an error

20220308 13083155 EXC   ESQLite3Exception {"ErrorCode":1,"SQLite3ErrorCode":"secERROR","Message":"Error SQLITE_ERROR (1) [SELECT RowID,LogonName,DisplayName,PasswordHashHexa,GroupRights,idusera,username,pass,blokada,wygasa,fullname,ile,pass2,lastlogin,kod,phone,canreset,lastask FROM Users WHERE LogonName=?] using 3.31.0 - Class not registered, extended_errcode=1"} [] at 90c886  stack trace API 6df468 6df490 40b828

#3 mORMot 1 » MSSQL Server Index problem » 2022-03-01 11:45:45

konsul41
Replies: 4

MSSQL server

Does the mormot always have to have index
type

CONSTRAINT PK_Users PRIMARY KEY (iduser)

Why the question, I have a table with index

CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED

And I get an error

"Error SQLITE_ERROR (1) [PRAGMA table_info (Users);] using 3.31.0 - Unregistered class, extended_errcode = 1."

Is there a workaround for this issue?

#4 Re: mORMot 1 » Self-verification of the password » 2022-02-11 13:27:03

In my class
  TUsers = class (TSQLAuthUser)
I overwritten
class function ComputeHashedPassword (const aPasswordPlain: RawUTF8;
       const aHashSalt: RawUTF8 = ''; aHashRound: integer = 20000): RawUTF8; override;
is this a good direction.
It worked, I logged in with the data from the table.

#5 Re: mORMot 1 » Self-verification of the password » 2022-02-11 13:07:53

How to write the password encryption procedure in the client?

And basically how to change the password system?
Which direction should I go?

#6 mORMot 1 » Self-verification of the password » 2022-02-11 09:17:39

konsul41
Replies: 5

I am currently using Mormot to connect to an old MSSQL database which has its own login system (table) with its own password encryption.
I made my own TAuthUser and mapped the AuthUser fields to the fields in the table.
I am running TSQLRestServerAuthenticationDefault and fetching user from database is currently working. I am getting an error that the password is not valid.

Now I would like to use the method of password transmission used by TSQLRestServerAuthenticationDefault and only decode the password on the server side and check if the password is correct.
Is that a good way and is it possible at all?

#7 mORMot 1 » Login from Android » 2020-10-20 12:34:45

konsul41
Replies: 0

I am trying to log into the mormot server
at
ServerDB.AuthenticationRegister (TSQLRestServerAuthenticationDefault);

is modeled on
https://github.com/synopse/mORMot/blob/ … tcode.java

but I can't login

Android (Java)
...
    private String passwordHashHexa = "synopse";
    private String user = "User";
...
    if (token == "")
                return false;
    //ModelRoot/auth?UserName=...
...
   //the problem is still how to encrypt the password?

    URL url = new URL(serviceUrl  +
                              "/" + this.root +
                              "/auth?UserName="+this.user+
                              "&PassWord="+SHA256(root + token + aNonce + user +passwordHashHexa)+
                              "&ClientNonce="+aNonce);


Since the code that is on the forum and quoted by me, a lot has changed in Android and Google managed to break with Apache and Apache code flew from Android. Therefore, HttpUtils cannot be used.
Has anyone had this before?

#8 Re: mORMot 1 » I cannot register the service (interface). » 2020-07-11 16:29:45

Strange problem my server hangs on the ruler
TThread.Synchronize (synch.Context ^ .RunningThread, event)
line 39423 in the mormot.pas file


local variables
SYNCH={CONTEXT = 0x7ffff5e9b3e0, ACTION = DOCALLMETHOD, CALLMETHODARGS = 0x7ffff5f18898, INSTANCE = 0x7ffff5f18898, THREADMETHOD = {Proc = {procedure (POINTER)} 0x7ffff5f184a0, Self = 0x43017b}}
BACKGROUNDTHREAD=0x0
EVENT={Proc = {procedure (POINTER)} 0x7ffff5f18470, Self = 0x7ffff5f184a0}

On Client Error
TInterfacedObjectFakrClient.FakeCall(IAdmin1.GetList...
failed: 'URI root/Admin1.GetListaUzytkownikow/2 []
returned status 'Not Implemented' (501 - Server not reachable or broken connection)'

After closing the message, communication with the server in a different scope is normal. So the connection was not broken.

If you could direct me where to look next

#9 Re: mORMot 1 » I cannot register the service (interface). » 2020-07-10 12:23:45

Of course you're right. Thanks.

I have not written anywhere yet.
Mormot is great. May the force be with you.

#10 mORMot 1 » I cannot register the service (interface). » 2020-07-10 10:38:37

konsul41
Replies: 4

Linux Debian server written via Lazarus.
I cannot register the service (interface).
Interface

IAuth = interface(IInvokable)
    ['{E62D2F00-CB21-42FA-8284-AD7007510857}']
    function GetListaUzytkownikow(): RawJSON;
end;

Implementation

 TAuthService = class(TInterfacedObject, IAuth)
  public
    function GetListaUzytkownikow(): RawJSON;
    function GetHierarchy(): RawJSON;
  end;

It's classic.

Server code

...
TMethodServer = class(TSQLRestServerDB)
  strict private
...

Application.Log(etInfo,'Rozpoczęcie procedury startowej');
  Model:= TSQLModel.Create ([TSQLAuthGroup, TAuthUser,TFaktura,TRaportKasowy,TRaportDobowy]);
  ServerDB:= TMethodServer.Create (Model, 'demed.db3',true);
  ServerDB.CreateMissingTables();
  ServerDB.ServiceRegister (TAuthService, [TypeInfo (IAuth)],sicClientDriven).SetOptions([],[optExecInMainThread,optFreeInMainThread]);

Error:
Project lserv raised exception class 'EServiceException' with message:
TServiceFactoryServer.Create: IAuth alredy exposed as TMethodServer published method

In file '../mormot/SQLLite3/mORMot.pas' at line 58046:
raise EServiceException.CreateUTF8('%.Create: I% alredy ...


What does it mean that it is already exposed?
How to properly register interface (service) in Lazarus on Linux?

#11 Re: mORMot 1 » Unserialise array » 2020-06-21 07:42:39

I made collections and works.

#12 Re: mORMot 1 » Unserialise array » 2020-06-19 15:38:56

But this is greatly reduced, and only what is needed is cut out

#13 mORMot 1 » Unserialise array » 2020-06-19 15:23:23

konsul41
Replies: 4

Serwer site

TFirmaObjArray = array of TFirma;

TFirma = class(TPersistentWithCustomCreate)
...
    property nazwa : RawUTF8 index 250 read fFirmanazwa write fFirmanazwa;
...
  end;

TKonfiguracja = class(TPersistentWithCustomCreate)
  private
    ffirma: TFirma;
    ffir: TFirmaObjArray;
    function GetFirmaCount: Integer;
  public
    constructor Create; Override;
    Destructor Destroy; Override;
    function Add(): TFirma;
    property FirmaCount : Integer read GetFirmaCount;

  published
    property firma   : TFirma read ffirma write ffirma;
    property fir: TFirmaObjArray read ffir write ffir;
  end;


serialise
IRemoteSQL = interface(IInvokable)
    ['{8ECE1EBB-49CB-436E-8D36-6284B55189C1}']
    function  KonfiguracjaGet():RawUTF8;
    ...
  end;

function TServiceRemoteSQL.KonfiguracjaGet: RawUTF8;
var Konfiguracja : TKonfiguracja;
    Firma : TFirma;
begin

  Konfiguracja := TKonfiguracja.Create;
  try
    Konfiguracja.Firma:= TFirma.Create;
    Konfiguracja.Firma.nip:='test';

    with Konfiguracja.Add() do
    begin
      nazwa :='Firma 1';
      miejscowosc:='Łomża';
    end;
    ...
    TJSONSerializer.RegisterObjArrayForJSON([TypeInfo(TFirmaObjArray), TFirma]);

    result := ObjectToJSON(Konfiguracja, []);
 

result is
{
    "firma": {
        "IDFirmy": 0,
        ...
    },
    "fir": [{
            "nazwa": "Firma 1",...
        },
...
                {
            "nazwa": "Firma 4",...
        }
    ]
}
Client Site

JSON:=mainform.fService.KonfiguracjaGet();
  Konfiguracja := TKonfiguracja.Create;
  JSONToObject(Konfiguracja,@JSON[1],Valid);


How to reverse serialization correctly?
Or maybe you can do it better?

#14 Re: mORMot 1 » Error » 2020-06-16 18:27:43

The problem is that everything was working the day before.
I downloaded the content of links from this page
https://synopse.info/fossil/wiki?name=Get+the+source
or
https://github.com/synopse/mORMot/archive/master.zip


and I currently have a message that varies from 3.31.0 to current 3.32.2



...

Actually, I don't know what happened. I withdrew some of the code regarding the uprawnieniaUrzytkownika table and it started working, so the problem is not likely to affect mORMot.

#15 mORMot 1 » Error » 2020-06-16 15:50:47

konsul41
Replies: 2

What is this.
On the computer on which another user is playing, he was playing and .... this is happening. He doesn't know what he changed.

Error SQLIT_ERROR(1)[PRAGMA table_info(UprawnieniaUrzytkownika);] using 3.31.0 - vtable constructor failed: UprawnienieUrzytkownika, extended_errcode=1.



This happens on one computer.
I have the latest version.

#17 mORMot 1 » Error updating TDateTime field in Postgresql database » 2020-06-12 08:45:51

konsul41
Replies: 2

Baza Zewnętrzna Postgresql
Obiekt typu TDokument = class (TSQLRecord) zawiera

Postgresql External Database
Object of type TDokument = class (TSQLRecord) contains property of type TDateTime

TDokument = class (TSQLRecord)
  private
    fdata_wystawienia: TDateTime;
  published
    property data_wystawienia : TDateTime read fdata_wystawienia write fdata_wystawienia;
  end;

the database is created correctly

CREATE TABLE public.dokument (
    ...
    data_wystawienia timestamp NULL,
        ...
);


then I try to update the object's property with code

var Dokument : TDokument;
    Valid : boolean;
    value : Variant;
    tek   : String;
begin
  Dokument:=TDokument.Create;
  try
    JSONToObject(Dokument,@dok[1],Valid);
//
ServerDB.UpdateField(TDokumentClass(TDokument),TID(ID),'data_wystawienia',Dokument.data_wystawienia);
The property Document.display_date contains the correct date (the delphi preview shows 01.06.2020) as assumed, but I get the error reported by Postgresql in the form

Project ... raised exception class EPGNativeException with message '[FireDAC][Phys][PG][libpq]
Error "data_wystawienia" column test type timestamp without timezone but the expression is of type character varing.
... further standard Postgres description of what to do


What to do to update the timestamp field value?

#18 Re: mORMot 1 » mormot i BPL » 2020-05-27 18:45:45

I thought it was the operation of the menu.
No, that's not it.
I cleared all bpl of everything
i only do
LoadPackage
and
ModuleName: = ExtractFileName (getModuleName (BPLeMAIN [Length (BPLeMAIN)-1]));
UnloadPackage (BPLeMAIN [Length (BPLeMAIN)-1]);
modulename contains a valid file name

and I can only release the first BPL, and 2 and 3 not. I suppose all the following ones (which will be at all) cause the error "Invalid Package handle"
Can anyone verify this?

#19 Re: mORMot 1 » mormot i BPL » 2020-05-27 12:16:55

OKAY.
Google translator.

My program is a bit of a mix of technologies

// A factory that supports all plugins
IObjectFactory = interface
     ['{05C782E6-7DE7-46B4-82E0-22A5A64BEDB2}']
     procedure RegisterFactoryDriver(driver: IObjectFactoryDriver);
     procedure UnRegisterFactoryDriver(driver: IObjectFactoryDriver);
     function MakeNew(id: WideString): IUnknown;
     procedure Clear;
     function GetClient(): TSQLRestClientURI;
     procedure SetClient(const Value: TSQLRestClientURI);
     function UdostepnijKlienta(): TSQLRestClientURI;
   end;


procedure TObiekt.Exec(Sender: TObject);
var
    client    : TSQLRestClientURI;
    aResponse,
    RawBate   : RawUTF8;
    Lekarz    : TLekarz;
begin
  client:=fabryka.GetClient; //fabryka : IObjectFactory;
  client.CallBackGet('Eat',[],aResponse);
  Client.CallBackGet('GetFile',['filename','20200514_204819.jpg'],RawUTF8(RawBate));

  Lekarz:=TLekarz.Create;
  try
    Client.Model.AddTable(TLekarz);
    Client.Retrieve(1,Lekarz);
    ShowMessage('Imię i nazwisko Lekarza '+Lekarz.imie+' '+Lekarz.nazwisko);
  finally
    Lekarz.Free;
  end;
  Client.CallBackGet('Eat',[],aResponse);
end;

This function is connected with BPL to the main program menu and it works

the question concerns the mormot and the method of transmission
client: TSQLRestClientURI;
to bpl
is such a way safe or should it be done differently?
The question is because passing the client to BPL I lose tables from the model and I have to add
Client.Model.AddTable (TLekarz);

#20 mORMot 1 » mormot i BPL » 2020-05-26 07:01:21

konsul41
Replies: 3

Client Program
fClient :=  TSQLHttpClient.Create('localhost','888',fModel);

How to forward "fClient" to BPL?


BPL ładowany poprzez LoadPackage(PChar(FileName));


Or Which plug-in model to choose to leave the small main application (menu + loading plugins) and transfer the rest to BPL or dll plugins

#21 Re: mORMot 1 » Authentication » 2020-05-24 10:37:00

In fact, there is not much written in the documentation about changing the default users. I had a problem that all the time I was giving the wrong password or not to this user. Additionally, this group id was not entered in the user's properties. And that's why I had a problem all the time.
As for the documentation, it has a high entry threshold, at the beginning I missed a lecture for the following type:
"to have it, you have to do it this"

#22 Re: mORMot 1 » Authentication » 2020-05-22 06:46:35

I managed, thank you.
However, let me give myself an opinion.
The documentation is great, but unfortunately often some things are explained laconic.

#23 Re: mORMot 1 » Authentication » 2020-05-21 13:01:15

Yes she is great and "big" and my English is poor.
It is not that I have not read it but I am lost.
I want to add support for any depreciation and I'm getting lost.
I went back to the older code

ServerDB:= TMethodServer.Create (Model, 'demed',true);
  ServerDB.AuthenticationRegister(TSQLRestServerAuthenticationHttpBasic);
  ServerDB.CreateMissingTables();
  ServerDB.ServiceRegister (TServiceRemoteSQL, [TypeInfo (IRemoteSQL)],sicClientDriven).SetOptions([],[optExecInMainThread,optFreeInMainThread]);


  serwer := TSQLHttpServer.Create ('888', [ServerDB]);
  serwer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries

and in the webbrowser

http://localhost:888/root/Auth?Username=User

and result
{"result":"59284f0b01b5c5ac3193725ea6597df218429c39c53d6eaa009eea6ed6ab390f"}

46/5000
does this mean that the authorization is correct?


in server
...
serwer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
...
ServerDB.OnAuthenticationFailed:=Onfiled;


  aNewUser := TSQLAuthUser.Create;
  try

    aNewUser.PasswordPlain := 'karol';
    aNewUser.LogonName := 'karol';
    aNewUser.DisplayName := 'karol';

    aNewUser.Grouprights := pointer(ServerDB.MainFieldID(TSQLAuthGroup,'User'));

    //first time
if ServerDB.Add(aNewUser, true)<>0 then begin
      showmessage('User '+ aNewUser.LogonName + ' added.');
    //second time
    if ServerDB.Update(aNewUser) then begin
      showmessage('User '+ aNewUser.LogonName + ' added.');
    end;
  finally
    aNewUser.Free;
  end;
...
procedure Tmainform.Onfiled(Sender: TSQLRestServer; Reason: TNotifyAuthenticationFailedReason; Session: TAuthSession; Ctxt: TSQLRestServerURIContext);
begin
  Ctxt.Returns('błąd logowania' );
//User 'karol'   Reason= afUnknownUser

//Ctxt.finput=('UserName', 'User', 'Password', '62ddb6eea0ed774a5c120a65168fe88fdd83f694effada67752187cf4100af46', 'ClientNonce', '9f0b6ed455d8cb1b07c34044ea2001b7b1cfc1062bf75c84de651bea47378db9')
end;

#24 mORMot 1 » Authentication » 2020-05-21 06:09:23

konsul41
Replies: 5

I am using google translator

I need your help.
Delphi 10.3.3 Community
Code Delphi

Serwer side
TMethodServer = class(TSQLRestServerDB)...

...

FDPhysPgDriverLink1:= TFDPhysPgDriverLink.Create(nil);
  dataDir:=ExtractFileDir(GetModuleName(0))+'\data\';
  Model:= TSQLModel.Create ([TSQLAuthGroup,TSQLAuthUser,TLekarz]);
  VirtualTableExternalRegister (Model, [TLekarz],PropsFireDac,[]);
  ServerDB:= TMethodServer.Create (Model, 'demed',true);
  ServerDB.CreateMissingTables();
  ServerDB.ServiceRegister (TServiceRemoteSQL, [TypeInfo (IRemoteSQL)],sicClientDriven).SetOptions([],[optExecInMainThread,optFreeInMainThread]);
  serwer := TSQLHttpServer.Create ('888', [ServerDB]);
  serwer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries



Client side

fModel := TSQLModel.Create([TSQLAuthGroup,TSQLAuthUser,TLekarz],ROOT_NAME);
  fClient :=  TSQLHttpClient.Create('localhost',PORT_NAME,fModel);
  if not fClient.ServerTimeStampSynchronize then begin
    ShowLastClientError(fClient,'Please run Project16ServerHttp.exe');
    Close;
    exit;
  end;
  fClient.ServiceRegisterClientDriven(TypeInfo(IRemoteSQL),fService);


Sorry for the secular question ale
How to get client authorization?
The server with the client will be connected via VPN so in principle it does not have to be secure but I need information about the user and his rights.

Board footer

Powered by FluxBB