?
Solved

Disappearing records from DBF.

Posted on 2003-03-27
20
Medium Priority
?
329 Views
Last Modified: 2010-04-04
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?
0
Comment
Question by:Alesoftware
[X]
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
20 Comments
 
LVL 6

Assisted Solution

by:Stuart_Johnson
Stuart_Johnson earned 120 total points
ID: 8222477
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
 
LVL 1

Assisted Solution

by:grolschisgood
grolschisgood earned 120 total points
ID: 8222502
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
 
LVL 3

Assisted Solution

by:LukA_YJK
LukA_YJK earned 120 total points
ID: 8223424
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Alesoftware
ID: 8224373
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
 
LVL 1

Expert Comment

by:nafeelm
ID: 8225226


Have you set these variables for the multiuser environment:

Session.NetFileDir & Session.PrivateDir


and also the TransIsolation property of the Database to 'tiDirtyRead'
0
 

Author Comment

by:Alesoftware
ID: 8225455
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
 
LVL 1

Expert Comment

by:nafeelm
ID: 8225543

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
 

Author Comment

by:Alesoftware
ID: 8227415
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
 

Author Comment

by:Alesoftware
ID: 8227607
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
 
LVL 1

Expert Comment

by:nafeelm
ID: 8229589

ok will try this out & get back to you!
0
 
LVL 1

Expert Comment

by:nafeelm
ID: 8230105

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
 

Author Comment

by:Alesoftware
ID: 8241233
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
 
LVL 1

Expert Comment

by:nafeelm
ID: 8244011

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
 

Author Comment

by:Alesoftware
ID: 8245277
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
 

Author Comment

by:Alesoftware
ID: 8263776
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
 
LVL 1

Accepted Solution

by:
nafeelm earned 640 total points
ID: 8267277

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
 

Author Comment

by:Alesoftware
ID: 8285600
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
 

Expert Comment

by:CleanupPing
ID: 9316572
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

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 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