I hope someone will be able to help me solve this problem regarding Paradox tables on a network. I've written an application that has a set of Paradox tables. The application can be installed on more than one PC on a network with one central location for the tables. The problem is that it doesn't lock the record being edited by one user. I have set the Session's NetFileDir property to be the directory where the tables are located - so that all applications running on separate computers will access and use the same PDOXUSRS.NET file. Now what happens when the app is run on more than one machine - it creates an extra copy of PDOXUSRS.NET on the local hard drive's C: I have expressly set the session's netfiledir property at designtime and at run time it set's it to the same directory that the tables reside in (which are being shared).
Quote Since Borland stopped developing or maintaining the BDE several years ago I suggest that you not use it for any new development. To change the location of PDOXUSRS.NET open the BDE Administrator.
Am I missing something here? Please help as this is hindering any further development. Thanks in advance! Hi people, have you controlled each bde configuration? If there overall the same netfiledir (called NET DIR in the BDE Administrator by configuration driver nativ e Paradox) entry? If no then edit it to the same entry, to a shared network drive if the shared networkdrive not available a.NET-File will created on the first HD-Root directory.
If you will set the netfiledir at runtime, then must all DataawareControlls pointed to to the TDatabaseComponent(Databas eName = Name of TDatabaseComponent) You cannot run two Applications on a workstation that will use different.NET-Files meikl. Hi Meikl Thanks for your comment regarding the BDE configuration on each machine. Is there a way to do this at runtime? I'd like to make the program as easy and user-friendly as possible to aliviate the need for users to sit and configure the BDE manually on each machine using my application. All my table-components have their session property set to the session component who's netfiledir property I set at run time to be the same directory as the one containing all the shared DB files.
So I think all that is needed now is code to configure the BDE at runtime on any machine that runs my application. Your comments?
Thanks in advance. Hi Cybersoft, first, Sorry, instead TDatabase i meant TSession If you will set the netfiledir at runtime, then must all DataawareControlls pointed to the TSessionComponent(SessionN ame = SessionName of TSessionComponent) The Tsession should first set to active then the activate other dataawarecontrols or set tsession active in designmode. A general change of the default entry of NET DIR in the BDE is not recommended Should work, if all have read, write, access and deleterights on the shared netfiledirectory.
If you will run multiple instances of your App on one workstation the privatedir entry of each instance should be different. Hope, this helps meikl. Hi Meikl I've tried changing the BDE on both machines and it seems that both can still edit the same record at the same time - IE not locking the table when one user puts it into edit mode. I found this in the Delphi help file regarding the TSession component and the NetFileDir property: 'Delphi derives an initial value for NetFileDir from the BDE configuration file for the Paradox driver.
Any value assigned to NetFileDir at design time or runtime overrides the BDE configuration setting.' Although this is not true - because I write the value of the NetFileDir property to a text file during run-time and it is the value of that the BDE has been set to - not what my application set it to! And according to an article in the inprise.com developer support forum and techincal information database they state that the drive letters need not be the same on all the machines as long as they all inevitably point to the same directory containing the PDOXURS.NET file.
Just to let you know - all the Table components have their Session property set to the value of the Session's SessionName property. The Session's Active property is set to true at run-time and the value of the NetFileDir property is changed at run-time.
(well so I thought) At first I thought it may be a peer-to-peer network on 95 problem - but I've tested it here at work on two NT workstations on the network and the same occurs. Both machines can edit the same record in a table being edited.
BUT, the one difference I've noticed is that on my machine, on which I've developed the application, it actually does use the NetFileDir created at run time - although the other machines use the entry that was set using BDEAdmin. Why does it use the NetDirFile setting I assign it at runtime on my machine and not on the other machines. Another thing I noticed is that irrespective of what the NetFileDir setting is (and where it has been set) there is ALWAYS a PDOXUSRS.NET file created on the machine's C: drive in the root. When I checked the contents of the PDOXUSRS.NET file (when the NetFileDir was forcibly set with BDEAdmin) I noticed that both machine's usernames were in there but it didn't lock the table's record being edited by one user. I'm at wit's end here trying to figure this out. Your comments? Thanks in advance.
Hi Meikl Sorry - I did not mean to make it sound as if I'm relying on you completely - it was more generally speaking:-) The default entry on all the machine's I've tested is: C: (which is the default when you install BDE for the first time). What puzzles me is: 1) the fact that another local PDOXUSRS.NET file is being created on every machine running my application 2) that even though the PDOXUSRS.NET file residing in the shared location where the main tables are has both username's in it - but still doesn't lock the record. Patiently awaiting your response (and anyone else that may be able to shed some light on this).
Again, thanks in advance for time and effort. Hi Cybersoft, and its right that both machines can edit the same record at one time? Really mysterious, because, has one machine set the table in dsEdit Mode (i.e. With table1.edit)the second cannot do this and becomes normally an exception (like record locked by user xy), the second can only read the record, until the first machine has posted it. And if you use no alias-Entry, then you have entered a Path in each DataAware-Control or use a TDatabase-Componet? There is no lock until one station edits a record!!
Hi Meikl Indeed that is why I am so completely confused about this whole situation. I've tried running the app twice on my local machine at work (NT) - and it raises the exception that the record is locked by another user (giving the local machine's logged in user name). But as soon as you attempt the same test on a network with two computers - both can edit the same record at the same time. What bothers me is that even though the NetFileDir is being set correctly on both machines - and to the same shared directory (which DOES have full read/write rights) - it seems to ALSO create a local PDOXUSRS.NET file on each machine. I'm still baffled as to how it doesn't raise the 'locked record' exception because if you look at the record contents of the shared PDOXUSRS.NET file it does in fact show both usernames of both machines using that table. I can, if needed, send you a copy of my app so that you can test it out yourself - if you could - I'd greatly appreciate it. Thanks again Demitri.
Okay Cybersoft. A couple things to remember 1)Try to have the Pdoxusrs.net file mapped to a common drive that all the users can see, using the same drive letter. Very important in peer to peer networks. S: pdoxnet 2)Create a separate directory for the DataFiles using rule one. S: PdoxData 3)If your executable is on the network place it in it's own directory i.e. S: MyProgram 4)Configure the BDE through the BDE administrator.I think your headaches will go away.Lots of programs require some tinkering by users.Look at hooking up to the internet.you have to set your tcp/ip.you get the picture. 5)If you see more than one Pdoxusrs.lck, paradox.lck and pdoxusrs.net file.something is wrong.lck files should only be in directories with data files.net file should only be where specified in the bde aministrator.
![Pdoxusrsnet Pdoxusrsnet](http://web.suffieldacademy.org/ils/netadmin/docs/howto/odin_install/docs/images/bde_path_close.png)
Hope this helps. Also read deploy.txt found in your borland delphi # deploy.txt. Hi Rickpet Halelulja! Finally the one small minor (but very important detail) that has been missing since the beginning. Thanks for your comment - it really helped.
The only point that is required from your comments is point number one - specifically that the drive LETTER and directory names as the shared directory for the PDOXUSRS.NET file MUST be the same on both directories. All that I did was map a directory on the machine with the main database files to the same directory and drive letter on the remote machine and voila!
It locks the records. It seems that the directory in which the Main database files lie is written to the PDOXUSRS.NET file. Now when the other application (on the 'server') tries to access the PDOXUSRS.NET file to lock records it sees a different NET directory name as is used by the application and then creates it's own PDOXUSRS.NET file and allows a locked record to be edited. There is no change required to the BDE configuration.
All one has to specify before using your tables are the following fields: NetDir: Same drive letter - shared (read/write/create/delete) PrivateDir: Different directory for each application SessionName: Eeach DB component must use the same SessionName To ensure proper working I've set the NetDir value to the shared directory containing the main DB files. I hope this helps other people as well who may come accross the same problem in the future.
Rickpet please post your comment again as the answer so that I can grade you and give you the points. Thanks again to everyone Demitri.