#1 2024-05-28 12:30:10

Bo
Member
From: Melbourne
Registered: 2016-07-04
Posts: 57
Website

EOleSysError "Class not registered"

I use one of mORMot 2's great features which is "CreateMissingTables" to not writing db scripts for updating my MS SQL database, initially I used master branch for developing and then wanted to use 2.2 stable for production, but I found 2.2 stable did not work and got the exception per title when calling rest server's CreateMissingTables, I used the sample project "ex\ThirdPartyDemos\martin-doyle\05-HttpDaemonORM\src\Project05HttpDaemon.dproj" to verify it and it failed with 2.2 stable too, below is the modified code to use MS SQL:

procedure TSampleDaemon.Start;
var
  Props: TSqlDBOleDBConnectionProperties;
begin
  Props := TSqlDBOleDBMSSQL2018ConnectionProperties.Create('localhost','mormot','','');

  SQLite3Log.Enter(self);
  Model := CreateSampleModel;
  VirtualTableExternalRegister(Model,[TOrmSample],Props);
//  SampleServer := TSampleServer.Create(Model, ChangeFileExt(Executable.ProgramFileName,'.db'));
  SampleServer := TSampleServer.Create(Model, ':memory:');
  SampleServer.DB.Synchronous := smOff;
  SampleServer.DB.LockingMode := lmExclusive;
  SampleServer.Server.CreateMissingTables; //<-- throw exception: EOleSysError "Class not registered"
  HttpServer := TRestHttpServer.Create(HttpPort,[SampleServer],'+',HTTP_DEFAULT_MODE,4 );
  HttpServer.AccessControlAllowOrigin := '*';
  SQLite3Log.Add.Log(sllInfo, 'HttpServer started at Port: ' + HttpPort);
end;

There was also a following exception:

Fatal exception ESqlite3Exception raised with message
  Error SQLITE_ERROR (1) [Step] using 3.44.2 - Class not registered

Do I have to use master or there is a quick fix ?

Last edited by Bo (2024-05-28 12:42:39)

Offline

#2 2024-05-28 13:21:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: EOleSysError "Class not registered"

My guess is that you did not install the OleDB provider for the proper Win32 or Win64 platform of your application.

Online

#3 2024-05-29 04:58:51

Bo
Member
From: Melbourne
Registered: 2016-07-04
Posts: 57
Website

Re: EOleSysError "Class not registered"

This happens to another machine too. The same application and same machine work okay if the application is compiled with master branch of mORMot 2. Does 2.2 stable support driver behind TSqlDBOleDBMSSQL2018ConnectionProperties?

Offline

#4 2024-05-29 06:31:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: EOleSysError "Class not registered"

If it works with master, use master branch. wink

Online

#5 2024-05-30 00:14:10

Bo
Member
From: Melbourne
Registered: 2016-07-04
Posts: 57
Website

Re: EOleSysError "Class not registered"

I will use master until you get next stable one. I just need to find a way to stop rebuild my app when there is an update in master.

Offline

#6 2024-05-30 08:21:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: EOleSysError "Class not registered"

The next stable should be out shortly.

SQlite3 has a new stable revision, and we did a lot of work in the trunk since 2.2.

Online

#7 2024-05-30 09:52:59

Bo
Member
From: Melbourne
Registered: 2016-07-04
Posts: 57
Website

Re: EOleSysError "Class not registered"

That is great, looking forward to next one.

I have found out that it is a bug in 2.2 stable in TSqlDBOleDBMSSQL2018ConnectionProperties which you have fixed in master commit

Revision: 8e0ecde3ba26324e9d270493c58c16393355afb4
Author: Arnaud Bouchez <ab@synopse.info>
Date: 25/1/2024 01:45:48
Message:
fixed TSqlDBOleDBMSSQL2018ConnectionProperties
as reported by https://github.com/synopse/mORMot2/issues/238
----
Modified: src/db/mormot.db.sql.oledb.pas
Modified: src/mormot.commit.inc

Offline

Board footer

Powered by FluxBB