Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


read data from dbf file

Posted on 2014-03-20
Medium Priority
Last Modified: 2014-04-06
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?

Question by:b001
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 30

Expert Comment

by:Olaf Doschke
ID: 39942080
.NET does not really connect and disconnect from DBFs, it's just working through either ODBC Driver or OLEDB PRovider and these do the usual native access of DBF files as you do in VFP. Just because you have to open a connection with an OLEDB connection string or a DSN in .NET doesn't make DBFs connected or disconnected and working with a server, this is just the ODBC/OLEDB nomenclature.

Bye, Olaf.

Author Comment

ID: 39943574
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.
LVL 30

Expert Comment

by:Olaf Doschke
ID: 39943663
-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.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 43

Expert Comment

ID: 39943921
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.

Author Comment

ID: 39944725
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?
LVL 30

Accepted Solution

Olaf Doschke earned 2000 total points
ID: 39945280
Sounds like the oplocks problem.

Apply this to the Win8 client:

Good Luck.

Bye, Olaf.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question