Disappearing records from DBF.

I have a table named 'vendas.dbf' in a network drive (S:). It's used by many computers. Actually each machine do a quick append in this table with a 'dbiSaveChanges' on the afterpost event. An append is done from 5 to 5 minutes on each machine.
  The madness is that many records are being losen a day.

PS: I don't succeed repeat this situation with other machines.

Somebody could help me, please?
AlesoftwareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Stuart_JohnsonCommented:
How are they lost?  They're posted, but just don't appear afterwards?

Can you write validation code into your app which checks to see if the record has been added before proceeding?

dBase tables are not good to write to over a network with multiple people updating them.  This is asking for trouble.  I'd be looking at changing the database.
0
grolschisgoodCommented:
what method are they using to connect to this database?  with BDE you have to be careful how you enter the path to the database eg the following are valid BDE entries

c:\exonet6\testdata.gdb
c:/exonet6/testdata.gdb
server:c:\exonet6\testdata.gdb
server:c:/exonet6/testdata.gdb
c:\exonet6/testdata.gdb

As you can see you can use either forward or back slashes.  However the format of the path effects the way BDE caches for the database.  If two different users on different machines attach to the same database using two different methods above, then you can lose data becuase BDE will create two caches for the database.

in short, make sure all machines use the same path format
0
LukA_YJKCommented:
There must be a BDE options for network lock.
If you simply should append and close table. Maybe it is simpler to open the table exclusive, then loop until it is unlocked, open it, append and close (so others could open it).
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

AlesoftwareAuthor Commented:
Actually, my friend and I discovered that when the server machine try to insert records, it overwrites the other machines insertions just because the server machine doesn't see what the other machines did.
  PS: Only the server doesn't see the other machines inserts.

If I close and open the table before insert a new record, it solves the problem but it's not possible for me.

I tried to use dbiForceReRead() but it didn't work too.
0
nafeelmCommented:


Have you set these variables for the multiuser environment:

Session.NetFileDir & Session.PrivateDir


and also the TransIsolation property of the Database to 'tiDirtyRead'
0
AlesoftwareAuthor Commented:
Yes, I have already tried Session.NetFileDir, privatedir;
 Database.params[x] -> NetFileDir and PrivateDir; Resync
 and updateCursorPos.
It's like if the server is the authority. If it's using the table, nobody can change it because it'll be lost.
0
nafeelmCommented:

Which Drivers are you using: 'Dbase' or 'Foxpro'?

How are u updating the table ... by using the TTable component or the TQuery component!

The problem could also lie in the BDE settings (BDE Admin.) of the driver you are using!

0
AlesoftwareAuthor Commented:
If you have 2 computers in a network you can simulate it.
Make a simple project just to access a table and allow to configure the databasename. You must configure both machines to access the same table and the table must be in one of the 2 machines and working with a simple DBF with only 2 records.
  You'll see, when you insert a record on the client machine you won't see it at the server machine till you close and open it again.

PS: I tried FOXPRO driver and DBASE one. None of them works.
0
AlesoftwareAuthor Commented:
If you have 2 computers in a network you can simulate it.
Make a simple project just to access a table and allow to configure the databasename. You must configure both machines to access the same table and the table must be in one of the 2 machines and working with a simple DBF with only 2 records.
  You'll see, when you insert a record on the client machine you won't see it at the server machine till you close and open it again.

PS: I tried FOXPRO driver and DBASE one. None of them works.
0
nafeelmCommented:

ok will try this out & get back to you!
0
nafeelmCommented:

i have tried it out ... it works perfectly fine with me ... i could add data via any machine on my network & it refreshed automatically on the other machines.

i too tested it on a network drive (s:\)

0
AlesoftwareAuthor Commented:
In a first look, I couldn't see the problem too. Try do set the databasename of one machine to 'C:\TEMP' and the other machine should access this same folder. The problem will happen only on the machine that is set to c:\temp. When the other machine add some record you will not see it on this machine.
0
nafeelmCommented:

Are u telling me that the Table 'vendas.dbf' is saved in 'C:\TEMP'

And you have shared this 'C:\TEMP' directory & mapped the same on other machines as 'S:\' drive

Is it so ?

0
AlesoftwareAuthor Commented:
Yes, that's it. I saved 'vendas.dbf' in 'C:\TEMP'. I shared 'C:\' & mapped then same as 'S:\' no other machines and there I access 'S:\TEMP'.
 The machine that uses 'C:\TEMP' cannot see what the other machines are doing till it closes and open the table.
0
AlesoftwareAuthor Commented:
I'm sorry, I don't understand what happend to my last answer. Let me say again:
 Yes, that's it. I saved 'vendas.dbf' in 'C:\TEMP'. I shared 'C:\' & mapped this path on the other machine as 'S:\'. Then I access 'C:\TEMP' on the server machine and
on the client machine I access 'S:\TEMP'.
 The machine that uses 'C:\TEMP' cannot see what the other machines are doing on this database till it closes and open the table.
0
nafeelmCommented:

It just works fine for me. I dont know where exactly are u going wrong ?

Anywhere heres what i did:

1) Created a 'vendas.dbf' file on c:\temp
2) Mapped this c:\ on another machine as s:\

3) Created a new application
4) Droped components on the form - TDatabase, TTable, TDataSource, TDBNavigator, 3 TDBEdit (linked to code, name, address fields in the table)
5) Set the following properties in Database Editor
PATH=c:\temp
DEFAULT DRIVER=PARADOX
ENABLE BCD=FALSE
PASSWORD=

In the Options i 'Unchecked' Login Prompt & 'Checked' Keep inactive connection.

(Note i set PATH=c:\temp on the exe which runs at the server end & PATH=s:\temp which runs at the local end)

6) I set the Table name to 'vendas.dbf' & linked it upto a DataSource with AutoEdit set to False. I also linked the TDBNavigator to this DataSource.

7) Then i run this exe on both the machines. If i add any data on the server it gets updated & can be viewed at the local end & vice versa.


Just check if this is of any help to you ... or else i will have to mail you the same exe & you can test it at your end.

-nafeel-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlesoftwareAuthor Commented:
nafeel, That's exactly what I did.
Maybe my Delphi version can have this bug. I'm using Delphi 4 nowadays. Then send me your executable project if it's fine for you, with a TEdit for entering the path and a button to open the table with this path.

I'll try it and give you a feed back.

My email is alesoftware@hotmail.com

Thanks.
0
CleanupPingCommented:
Alesoftware:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.