Code: Select all
Try
If Not ZConnection.PingServer Then Reconnect;
Except
On E:Exception Do
If E Is EZNotSupportedException Then
PingTimer.Enabled := False
Else
If E Is EZConnectionLost Then
Reconnect
Else
HandleException(E); // Log and show error message
End;
Now, as EZDatabaseError was raised the application still thought the connection is active and did not reconnect, which is not good.EZDatabaseError was raised while pinging server with the message SQL Error: ORA-03113: end-of-file on communication channel
Code: 3113 Message: PingServer
00e88501 MyApplicat.exe ZAbstractConnection 1017 TZAbstractConnection.ConnectionLost
009706ea MyApplicat.exe ZDbcConnection 1193 TZAbstractDbcConnection.ReleaseImmediat
009744bb MyApplicat.exe ZDbcConnection 2234 TZAbstractSingleTxnConnection.ReleaseImmediat
00ce4785 MyApplicat.exe ZDbcOracle 874 TZOracleConnection.ReleaseImmediat
00ce6774 MyApplicat.exe ZDbcOracle 1427 TZOracleConnection.HandleErrorOrWarning
00ce4a88 MyApplicat.exe ZDbcOracle 925 TZOracleConnection.PingServer
00e88e90 MyApplicat.exe ZAbstractConnection 1253 TZAbstractConnection.PingServer
0116b52c MyApplicat.exe uBaseSQLMyApplicatFrame 217 TBaseSQLMyApplicatFrame.PingTimerTimer
007a3ee0 MyApplicat.exe Vcl.ExtCtrls TTimer.Timer
TZOracleConnection.HandleErrorOrWarning already knows and translates 3113 as loss-of-connection, but when we walk the callstack we find this:
Code: Select all
procedure TZAbstractConnection.ConnectionLost(var AError: EZSQLConnectionLost);
var Err: EZSQLConnectionLost;
EventErrorRaised: Boolean;
ADatBaseError: EZDataBaseError;
begin
Err := AError;
AError := nil;
try
CloseAllLinkedComponents;
except end;
EventErrorRaised := True;
try
if Assigned(FOnLost) then
FOnLost(Self);
EventErrorRaised := False;
finally
if EventErrorRaised then begin
if (Err <> nil) then
FreeAndNil(Err);
end else begin
if Err = nil //should not happen
then ADatBaseError := EZDataBaseError.Create('Connection lost.')
else begin
ADatBaseError := EZDataBaseError.CreateFromException(Err);
FreeAndNil(Err);
end;
raise ADatBaseError;
end;
end;
end;