Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

BDE and Paradox

Posted on 2001-07-18
18
Medium Priority
?
919 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
[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
  • 5
  • 3
  • 3
  • +5
18 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6293480
install the bde, create the alias you used
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6293584
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
ID: 6293725
My app. has to run from a CD (without install)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6293741
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:Mohammed Nasman
ID: 6293742
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
ID: 6293777
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 200 total points
ID: 6293803
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
ID: 6294959
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
 
LVL 3

Expert Comment

by:VSF
ID: 6295912
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
ID: 6297213
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
ID: 6297434
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
ID: 6297731
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
ID: 6305646
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
ID: 6305678
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
ID: 6307463
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
ID: 6789579
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
ID: 8703492
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

598 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