App losing db connection
Posted
by DaveKub
on Stack Overflow
See other posts from Stack Overflow
or by DaveKub
Published on 2010-06-11T19:07:17Z
Indexed on
2010/06/11
19:13 UTC
Read the original article
Hit count: 249
delphi
I'm having a weird issue with an old Delphi app losing it's database connection. Actually, I think it's losing something else that then makes the connection either drop or be unusable. The app is written in Delphi 6 and uses the Direct Oracle Access component (v4.0.7.1) to connect to an Oracle 9i database. The app runs as a service and periodically queries the db using a TOracleQuery object (qryAlarmList). The method that is called to do this looks like this:
procedure TdmMain.RefreshAlarmList;
begin
try
qryAlarmList.Execute;
except
on E: Exception do
begin
FStatus := ssError;
EventLog.LogError(-1, 'TdmMain.RefreshAlarmList', 'Message: ' + E.Message);
end;
end;
end;
It had been running fine for years, until a couple of Perl scripts were added to this machine. These scripts run every 15 minutes and look for datafiles to import into the db, and then they do a some calculations and a bunch of reads/writes to/from the db. For some reason, when they are processing large amounts of data, and then the Delphi app tries to query the db, the Delphi app throws an exception at the "qryAlarmList.Execute" line in the above code listing. The exception is always:
Access violation at address 00000000. read of address 00000000
HOW can something that the Perl scripts are doing cause this?? There are other Perl scripts on this machine that load data using the same modules and method calls and we didn't have problems. To make it even weirder, there are two other apps that will also suddenly lose their ability to talk to the database at the same time as the Perl stuff is running. Neither of those apps run on this machine, but both are Delphi 6 apps that use the same DOA component to connect to the same database. We have other apps that connect to the same db, written in Java or C# and they don't seem to have any problems.
I've tried adding code before the '.Execute' method is called to:
check the session's connection (session.CheckConnection(true); always comes back as 'ccOK').
see whether I can access a field of the qryAlarmList object to see if maybe it's become null; can access it fine.
check the state of the qryAlarmList; always says it's qsIdle.
Does anyone have any suggestions of something to try? This is driving me nuts!
Dave
© Stack Overflow or respective owner