Native MSSQL Driver throws EAureliusOdbcException

Hello,


I want to change my MSSQL Connection from dbGo to the Native Aurelius MSSQL Driver.
It seems to be working, but when I close my application, it throws a runtime error:

Im Projekt Project1.exe ist eine Exception der Klasse EAureliusOdbcException mit der Meldung 'Error -1: [Microsoft][ODBC Driver Manager] Fehler in der Funktionsreihenfolge' aufgetreten.

This comes from the Unit Aurelius.Drivers.Odbc.Classes by

finalization
  TOdbcEnvironment.Release;

My Developer Setup: 
MSSQL Server 2017 (Developer) on Windows 10 Pro (64bit)
Delphi 10.2 Tokyo
Aurelius 4.3 (latest so far)

I've created a sample Project to reproduce the error, but the forum don't support attachments.

Here my steps to reproduce:
1. Create a new Vcl Application
2. Add a TMS Connection with the Wizard
3. Setup a MSSQL Native Aurelius Client Connection
4. Add the DataModul in the uses from the Mainform and add a button and this sample Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  Conn: IDBConnection;
  OM: TObjectManager;
begin
  Conn := MSSQLConnection.CreateConnection;
  Conn.Connect;

  OM := TObjectManager.Create(Conn);
  OM.Flush;
end;
5. Run the application, push the button and close.

Did I a mistake or is this a bug?
Thanks in advance!

P.S.: I love your TMS Aurelius ORM, thanks a lot!

You are not destroying object manager, which in turn doesn't decrease IDBConnection reference count, which doesn't release SQL Server connection.

Fix:



procedure TForm1.Button1Click(Sender: TObject);
var
  Conn: IDBConnection;
  OM: TObjectManager;
begin
  Conn := MSSQLConnection.CreateConnection;
  Conn.Connect;


  OM := TObjectManager.Create(Conn);
  OM.Flush;
  OM.Free; // Add this
end;
Wagner R. Landgraf2019-01-31 00:08:34

Thank you, I will test this!