Solved

BDE Filesharing

Posted on 1998-12-06
3
464 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
[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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 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