b001
asked on
read data from dbf file
Hi Experts
I have been having problem where files are left open and on shutdown it corrupts the file.
is there a way to open c connection to dbf table and read the data like in .net So that as soon as you read the data you can close the connection?
thanks
I have been having problem where files are left open and on shutdown it corrupts the file.
is there a way to open c connection to dbf table and read the data like in .net So that as soon as you read the data you can close the connection?
thanks
ASKER
HI Olaf
What I am trying to achieve is that no table is left in use in case there is power cut and the files get corrupted. Please advice what is the best way to stop getting files corrupted.
What I am trying to achieve is that no table is left in use in case there is power cut and the files get corrupted. Please advice what is the best way to stop getting files corrupted.
-USV to prevent power outages, so you only need to deal with users shutting down windows.
-ON SHUTDOWN rect with not allowing Windows to shutdown
-Turn off oplocks (turn off smb2 protocol to be able to turn off oplocks)
-Not using DBFs at all
-....
It's very unlikely you get corruptions just because windows shuts down. You have to write during the shutdown to corrupt files. File corruptions only occur at writing. In case of power outages nothing happens to a file just because it is open.
Bye, Olaf.
-ON SHUTDOWN rect with not allowing Windows to shutdown
-Turn off oplocks (turn off smb2 protocol to be able to turn off oplocks)
-Not using DBFs at all
-....
It's very unlikely you get corruptions just because windows shuts down. You have to write during the shutdown to corrupt files. File corruptions only occur at writing. In case of power outages nothing happens to a file just because it is open.
Bye, Olaf.
Olaf is correct. The DBF file cannot become corrupted without writing to it. If this really happens to you then you should look at your hardware reliability.
OK, let suppose you are writing to the DBF file from .NET
To minimize the damage possibility you have to close the connection or the file whenever it is not used. You may also execute the FLUSH or FLUSH FORCE command which writes all changes to the disk so the failure or user stupidity cannot corrupt data in buffers.
You should disclose how do you access DBF files then we may tell more.
BTW, DBF files on our server accessed by several hundred users every day were not corrupted for years. The point is the stable environment and no direct network access to DBFs. Interesting is the fact data are not damaged even when we kill all instances accessing them... The reason could be VFP transactions which are minimizing the disk access.
OK, let suppose you are writing to the DBF file from .NET
To minimize the damage possibility you have to close the connection or the file whenever it is not used. You may also execute the FLUSH or FLUSH FORCE command which writes all changes to the disk so the failure or user stupidity cannot corrupt data in buffers.
You should disclose how do you access DBF files then we may tell more.
BTW, DBF files on our server accessed by several hundred users every day were not corrupted for years. The point is the stable environment and no direct network access to DBFs. Interesting is the fact data are not damaged even when we kill all instances accessing them... The reason could be VFP transactions which are minimizing the disk access.
ASKER
I have not had this problem for a long time. It has happened twice in last 2 weeks only on one machine that is running windows8 and it corrupted the same table. Could there be an reason for this to happen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bye, Olaf.