• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 945
  • Last Modified:

BDE and Paradox

I have to access Paradox tables. But when I run my app. on another computer, an error occurs when BDE try to initialize. How should I process?
Thanks
0
ralph78
Asked:
ralph78
  • 5
  • 3
  • 3
  • +5
1 Solution
 
kretzschmarCommented:
install the bde, create the alias you used
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hello
  for deploying ur application in other computer, use install shield, it will install the BDE and create the required alias automatically, you can find install shield express for delphi in Delphi cdrom
look also for other installers in torry site, some of them free
http://www.torry.net/install.htm

Mohammed Nasman
0
 
ralph78Author Commented:
My app. has to run from a CD (without install)
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
Mohammed NasmanSoftware DeveloperCommented:
hmmm, at least u need to install BDE for one time, without that i think it's imposibble :)

or try to use ADO instead of BDE
Mohammed
0
 
Mohammed NasmanSoftware DeveloperCommented:
hmmm, at least u need to install BDE for one time, without that i think it's imposibble :)

or try to use ADO instead of BDE
Mohammed
0
 
SteveWaiteCommented:
BDE needs reg entries that point to its files, installshield express would do that normally. Also you need the alias set up as well. (or program can use dir path to data instead).
You need to have your program check for and set these reg entries up the first time it's run, before the datamodule is created in your app. Also the alias can be set using the dbiAddAlias function at the same time.

Steve
0
 
kretzschmarCommented:
from borland:

-- paste begin

Accessing Paradox Tables on CD or Read-Only Drive - by Borland Developer Support Staff



 Technical Information Database

TI1333D.txt   Accessing Paradox Tables on CD or Read-Only Drive
Category   :Database Programming
Platform    :All
Product    :Delphi  All

Description:
This Technical Information document will step through the concepts
regarding accessing Paradox tables which are located on a CD-ROM or
any read-only device.

The Paradox locking scheme requires the existence of a PDOXUSRS.LCK
file to handle its locking logic. This file is generally created at
run-time and resides in the directory which also contains the tables.
However, with a CD-ROM there is not a way to create this file at
run-time on the CD-ROM. The solution is simple, we create this file
and put it on the CD-ROM when the CD is pressed. The following steps
will give you a very simple utility program for creating the
PDOXUSRS.LCK file which you will then copy to the CD-ROM image.

1. Starting with a blank project add the following components: TEdit,
TButton and TDatabase.


2. In the OnClick event for the button use the following code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  if ChkPath then
    Check(DbiAcqPersistTableLock(Database1.Handle,
               'PARADOX.DRO','PARADOX'));
end;


3. The ChkPath function is a user defined method of the form. It will
simply check the path entered in the Edit box and make sure it exists.
Here is the function:

function TForm1.ChkPath : Boolean;
var
  s : array[0..100] of char;
begin
  If DirectoryExists(Edit1.Text) then begin
    DataBase1.DatabaseName:= 'TempDB';
    DataBase1.DriverName:= 'Standard';
    DataBase1.LoginPrompt:= false;
    DataBase1.Connected := False;
    DataBase1.Params.Add('Path=' + Edit1.Text);
    DataBase1.Connected := TRUE;
    Result := TRUE;
  end
  else begin
    StrPCopy(s,'Directory : ' + Edit1.text + ' Does Not Exist');
    Application.MessageBox(s, 'Error!', MB_ICONSTOP);
    Result := FALSE;
  end;
end;

{ Note: Don't forget to put the function header in the public section
        of the form.}


4. There is one more thing you need to add before compiling, in the
Uses statement at the top of the unit add the following units:
  Delphi 1.0: FileCtrl, DbiProcs, DbiTypes, DbiErrs.
  Delphi 2.0: FileCtrl , BDE


When you have compiled and executed the utility program, it will
create two files in the directory you specified. The two files created
are: PDOXUSRS.LCK and PARADOX.LCK.

Note: The PARADOX.LCK file is only necessary when accessing Paradox for
DOS tables so you can delete it.


5. The only thing left for you to do is copy the remaining file
(PDOXUSRS.LCK) to the CD-ROM image. Of course your tables will be
Read-Only.

Note: If you want to clean up this utility for future use, you can
change the text property of the Edit box to be some default directory
and change the Caption property of the Button to be something more
meaningful.


Here is the final version of the code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,
  Forms, Dialogs,  DB, StdCtrls, FileCtrl,

  {$IFDEF WIN32}
    BDE;
  {$ELSE}
    DbiProcs, DbiTypes, DbiErrs;
  {$ENDIF }


type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Database1: TDatabase;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    function ChkPath : Boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

function TForm1.ChkPath : Boolean;
var
  s : array[0..100] of char;
begin
  If DirectoryExists(Edit1.Text) then begin
    DataBase1.DatabaseName:= 'TempDB';
    DataBase1.DriverName:= 'Standard';
    DataBase1.LoginPrompt:= false;
    DataBase1.Connected := False;
    DataBase1.Params.Add('Path=' + Edit1.Text);
    DataBase1.Connected := TRUE;
    Result := TRUE;
  end
  else begin
    StrPCopy(s,'Directory : ' + Edit1.text + ' Does Not Exist');
    Application.MessageBox(s, 'Error!', MB_ICONSTOP);
    Result := FALSE;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if ChkPath then
    Check(DbiAcqPersistTableLock(Database1.Handle,
               'PARADOX.DRO','PARADOX'));
end;

end.

--- paste end

meikl ;-)
0
 
ralph78Author Commented:
ok meikl, thanks but there's still something i can't get:
the pdoxusrs.lck is generated by this little application, and based on a path that the user have to enter in an edit box. but this path is absolute isn't it? so how could i enter it before burning my cdrom? and if the app runs on a pc wich use different drive letters that mine, i really don't see how it could work.

ralph!
0
 
VSFCommented:
Hope this helps1
VSF
www.victory.hpg.com.br

Use this function to solve the problem of different drive letters!
This function will return the CD Drive letter for you:

Obtendo a letra do drive de Cd-Rom
      Function FindFirstCDROMDrive: Char;
      Var
         drivemap, mask: DWORD;
         i: Integer;
         root: String;
      Begin
         Result := #0;
         root := 'A:\';
         drivemap := GetLogicalDrives;
         mask := 1;
         For i:= 1 To 32 Do
           Begin
             If (mask and drivemap) <> 0 Then
               If GetDriveType( PChar(root) ) = DRIVE_CDROM Then
                 Begin
                   Result := root[1];
                   Break;
                 End;
             mask := mask shl 1;
             Inc( root[1] );
           End;
      End;

      procedure TForm1.Button1Click(Sender: TObject);
      Begin
         ShowMEssage('CD-ROM Drive :'+FindFirstCDROMDrive );
      End;
0
 
ralph78Author Commented:
ok, the file i should create contain an absolute path on a CD-ROM, and this file will be burned on the cd. this path will depend of the machine where the program will run, so this path could be different between 2 machines.
0
 
ralph78Author Commented:
errr... i remember u that there is no installation possible. event if i create the *.LCK file, i get an error during the initalization of BDE.
thanks for your help,
ragards, Ralph
0
 
kretzschmarCommented:
sure,
at least you must install the bde on the target-pc,
even if the tables are residing on a cd-rom

a possibility how to deploy the bde easily is shown by simonet at
http://www.bhnet.com.br/~simonet/tipstricks/bdeinstcab.htm

just to say, indepedent what database u use, the target pc must have prepared to use the database
- by bde -> bde must be installed
- ado -> ado must be installed
- any other native components -> atleast the specific database-client software must be installed and configured

the only way, to get rid of any installation is to use a flatfile with selfwritten access routines

meikl ;-)
0
 
martin_gCommented:
Ralph
What do you have on your CD?  Do you have the BDE on the CD?  Are the Paradox tables also on the CD and then transferred to the harddrive for read-write?
0
 
martin_gCommented:
I found this free  component while surfing the net.  It's called BDE32 and is found at:
http://www.delphispirit.com/dbawvclindex.php
Claims you can place the BDE in a subdirectory under your app.  Once done, you cna run the app from anywhere, even from a network client.  May work for you...
0
 
ralph78Author Commented:
my app must work absolutly without installation, even a ragistry one, and on a computer with minimal data: windows nt server, but not office, not bde, almost nothing. i tried the bde32 component. the idea is pretty good, but it only works with visual component (like dbgrid). i'm using TQuery components, and they don't work with bde32. i tried apollo vcl too, but the base must be in read/write mode (i dunno why). they told me to use a non-exclusive mode, but i don't know how to turn it off. well, i think it's all, so i thanks u for all your answers, and hope you'll answer again!

regards, ralph
0
 
amp072397Commented:
ralph78:

Just a friendly reminder to return to your open questions.

thanks!
amp
community support moderator

2/7
0
 
Russell LibbySoftware Engineer, Advisory Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Kretzschmar's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now