Solved

BDE Filesharing

Posted on 1998-12-06
3
461 Views
Last Modified: 2013-11-23
I'm wanting to fileshare a database app (Paradox tables) on a LAN using standard BDE Aliases. The problem arises when I want to enable multiple accesses to the database. If I compile my app then I can run multiple copies on the local workstation with no problems, however, other users cannot connect. I fixed this by using Session.NetFileDir and Session.PrivateDir properties. This allows multiple users to access the table  ...  but now I can only run one instance of the app on each station. What do I need to do to allow multiple instances on multiple machines.

Thanx in advance

Darren
0
Comment
Question by:elkiors
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 20 total points
ID: 1349567
hi elkiors,

each instance will use a own privatedir

a sample for a random privatedir


          unit Unit1;

          interface

          uses
            Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
            Grids, DBGrids, Db, DBTables, filectrl;

          type
            TForm1 = class(TForm)
              Table1: TTable;
              DataSource1: TDataSource;
              DBGrid1: TDBGrid;
              TestSession: TSession;
              procedure FormCreate(Sender: TObject);
              procedure FormClose(Sender: TObject; var Action: TCloseAction);
            private
              { Private-Deklarationen }
            public
              { Public-Deklarationen }
            end;

          var
            Form1: TForm1;

          implementation

          {$R *.DFM}

          function randomname : String;
          var
            i : Integer;
            s : String;
          begin
            s := '';
            for i := 1 to 8 do
              s := s + chr(Random(25)+ 65); {Only Letters from A to Z}
            randomname := s;
          end;



          procedure TForm1.FormCreate(Sender: TObject);
          var s : String;
          begin
            s := Randomname;
            while DirectoryExists('c:\'+s) do s := Randomname;
            if createdir('c:\'+s) then
            begin
              TestSession.PrivateDir := 'c:\'+s;
              TestSession.Active := True;
              { open Database Components }
              table1.open;
            end
            else
            begin
              { Problem occured }
            end;
          end;

          procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
          var
            Found : Integer;
            SRec : TSearchRec;
          begin
            TestSession.Active := False; {All DatabaseConnections will be closed }
            { Delete Files in temporary Directory }
            Found := FindFirst(TestSession.PrivateDir+'\*.*', faAnyFile, SRec);
            while Found = 0 do
            begin
              If SRec.Name[1] <> '.' then {Ignore Entries . and .. }
                Deletefile(TestSession.PrivateDir+'\'+SRec.Name);
              Found := FindNext(SRec);
            end;
            FindClose(SRec);
            rmdir(TestSession.PrivateDir);
          end;

          end.

Thats is a simple Example. Their are no Try-Except Blocks in it, so it can be that by the
Filehandling raised an Exception.

I hope you can use this tip

meikl
0
 

Author Comment

by:elkiors
ID: 1349568
Hi Meikl,

I haven't tested the code but I can see what you're getting at, I kind of stumbled across the multiple private dirs myself while I was at work today, although I had know idea on how to go about testing for the existing session, so that's a great help.

BTW Just got notification of you asking if anyone is around on Q10097306 Updating a Paradox Table - the one by RainbowSoftware.

I have a feeling that bird has flown, so I haven't bothered to respond again, otherwise we'll just keep triggering eachother to look at that page.

It's to be hoped that he hasn't just taken an answer and run. For me it's plain common courtesy that makes this site as enjoyable as it is. When other's take advantage or become abusive then it puts a downer on the whole shebang.

Anyway I've rambled along enough, sorry there wasn't anymore points available , I'm just about running on empty.

See you on another thread

Darren
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349569
hi darren,

i will remember rainbowsoftware about Q10097306, if he/she/it place a new question here.
about the points, that doesn't matter, i am not here to get points en mas, its ok.

See you on another thread again

meikl


Q10097306
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

816 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now