Question

I am loosing my patience with "delay write failed" errors. It silently disconnects the database from the application so nothing gets saved in the database while using it. Is there a way to detect the occurrence itself so I can flash a warning ? Or perhaps monitoring the connection itself for a disconnection ? Everyone seems to miss the balloon tip from the Windows XP so I figured to flash a more visible warning that the application must be restarted. It seems Microsoft has found a way to force people to upgrade.... I suppose this could be done with a timer and constantly check connected users:

cxlabel1.Caption := IntToStr(DataModule2.ABSDatabase1.GetDBFileConnectionsCount);

But I was thinking more of checking/detecting for the occurence itself. Is there something in Delphi that can detect this? I would like to hear your ideas on this...

Was it helpful?

Solution

Putting this as an answer because the comment length is limited.

I have seen this before. IIRC, the problem you have is that the Delayed Write Error is an OS error, it has nothing to do with your application. Windows has already told you that the write has been committed correctly to disk. You would have to try and hook into the OS errors to see when this is happening.

You need to get the network issues resolved because that's where the problem is. In our situation it was a faulty router that was causing the problem.

It's unfair to expect users to check for the error message and then handle it. They could be out at lunch when it occurs as it's not immediate. They also have no way of know what has been saved and what hasn't. It's only a matter of time before your database is corrupted.

The problem with a timer is that it might tell you everything is fine because it triggers after the network resolves the problems.

A far better approach would be to switch to a Client/Server database. You can do this by setting up your own server that listens for web service or another remote call or switch to a database that supports client/server instead of using a file based database. This will tell you immediately when there is a problem with the save of data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top