Solved

BDE and Paradox

Posted on 2001-07-18
18
900 Views
Last Modified: 2013-11-23
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
Comment
Question by:ralph78
  • 5
  • 3
  • 3
  • +5
18 Comments
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
install the bde, create the alias you used
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
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
 

Author Comment

by:ralph78
Comment Utility
My app. has to run from a CD (without install)
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
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
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
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
 
LVL 3

Expert Comment

by:SteveWaite
Comment Utility
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
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
Comment Utility
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
 

Author Comment

by:ralph78
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 3

Expert Comment

by:VSF
Comment Utility
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
 

Author Comment

by:ralph78
Comment Utility
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
 

Author Comment

by:ralph78
Comment Utility
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
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
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
 
LVL 1

Expert Comment

by:martin_g
Comment Utility
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
 
LVL 1

Expert Comment

by:martin_g
Comment Utility
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
 

Author Comment

by:ralph78
Comment Utility
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
 

Expert Comment

by:amp072397
Comment Utility
ralph78:

Just a friendly reminder to return to your open questions.

thanks!
amp
community support moderator

2/7
0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

17 Experts available now in Live!

Get 1:1 Help Now