Link to home
Start Free TrialLog in
Avatar of Dazza051197
Dazza051197

asked on

Sharing a Database

I'm attempting to write a small application that will read and write to paradox tables.  2 instances of this program will be running on 2 separate computers that are networked, the first instance will want to write to data on c:\data and the next instance will want to write to the same data but it'll be e:\data  I can get the applications to read the data but when I append a record, the 2nd application doesn't see it until I close the app down and re-run it.  I'm obviously missing something, so If someone could help me out I'd appreciate it.

Thanks

Avatar of kretzschmar
kretzschmar
Flag of Germany image

hmm Dazza,

don't think it is solveable by this parameters,
because for both instances the tables should stay
in the exact same dir-entry of the alias,
not c:\data for one and e:\data for the other

also only one .Net file must be used by both instances

meikl
It doesn't see the data cause you are not refreshing the datasource. I would handle this by putting a ttimer component down on application 2 and every timeinterval run a refresh.

Query.Open; or Table.Open

or simply use the RequestLive property on TQuery.

Rob.
Avatar of Dazza051197
Dazza051197

ASKER

This still doesn't show the newly added/edited records a nd it also lets me edit the same record on both systems.
Can someone provide me with example code, and I'll up the points..
Thanks

hi Dazza,

i don't think that's a problem of your app, its a problem of the configuration of paradox. the entrys of the bde-alias must be in sync by both clients, that means char by char.

meikl
Thanks Kretzschmar, you pointed me along the right paths, literally.  I need to use UNC paths for the data and netdir, as it's C:\ on one and E:\ on the rest, If I use UNC then they are the same, ie. \\Machine1\C\Data then everything is OK, I also had to set Lcoal Share to true within BDE but I can live with that.

Please answer so I can give you the points.

ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Dazza,

I had this same problem.

Try this.

1) Make sure you have the same version BDE installed on each machine.

2) On the BDE Configuration tab double click Drivers, then double click
Native.
Click on PARADOX the defination tab will appear.
Make sure the NET DIR property is set to aim at your database folder
example: c:\Program Files\Crystal\Data the drive letter will
change on the guest machines example E:\Program Files\Crystal\Data.

3) On the BDE Configuration tab double click SYSTEM then INIT.
In the definition tab.
Default Driver should read PARADOX.
Local Share should be set TRUE.
These settings should be the same on each machine, don't forgat to save
the changes.

You will need to reboot the machines for these changes to take affect.

4) Drop a TSESSION component on your form,
Object Inspector Properties should be as follows.
Active False
AutoSessionName True
KeepConnection True
Name Session1
NetFileDir Blank (In other words nothing in it)
PrivateDir Blank
SessionName should set itself example: session1_1
SQLHourGlass True
Tag 0.

I also use a TDatabase.

5)
In the MainForm Oncreate I have the following Code.

procedure TCrystalForm.FormCreate(Sender: TObject);
var
DBPath: string;
ParamList: TStringList;
begin
{get the actual location of the database from the alias}
ParamList := TStringList.Create;
try
Session.GetAliasParams(DataBase.AliasName, ParamList);
DBPath := ParamList.Values['PATH'];
finally
ParamList.Free;
end;
Session1.NetFileDir := (DBPath) ;
Session1.PrivateDir := 'C:\TEMP';
Session1.OPEN;
DatePicker.Date := (Now);
Database.Connected := True;
end;



Asw