Solved

BDE Filesharing

Posted on 1998-12-06
3
460 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

16 Experts available now in Live!

Get 1:1 Help Now