[Solved] How to pass a TZConnection from an object to an other object. lazarus / 16-Databases ---------------------------------------------------------------------- Hansvb · 2021-08-12 11:18 Hi, In my main windowI start with making an Oracle connection. The creation is done in a separate class with a propery that will contain the connection: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i property ActiveOraConn : TZConnection Read FActiveOraConn Write FActiveOraConn; The OpenConnection() functie in the seperate class works but when I free the Oracle connection after I set the oracle connection property, the property is holding an empty or nil connection. So how can I pass a connection when '.connect' is succelfull? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TOracleConnection.OpenConnection() : Boolean;var  ...begin  try    ...    NewOraCon := TZConnection.Create(nil);    NewOraCon.Protocol := 'oracle';    NewOraCon.User := SchemaName;    NewOraCon.Password := Pwd;    NewOraCon.Database := DatabaseName;    NewOraCon.UseMetadata := False;    NewOraCon.LibraryLocation := OCIdllLocation     NewOraCon.Connect;    ActiveOraConn := NewOraCon;  // Set the property    NewOraCon.Free;  // This also seems to clear the property    Result := True;  except  on E : Exception do    begin          ...    NewOraCon.Free;      Result := False;    end;  end;end; ---------------------------------------------------------------------- Hansvb · 2021-08-12 14:05 Found it. Just use a Datamodule with a transaction on it. Now i can try to reproduce it without a datamodule.