Discussion:
Bde why install?
(too old to reply)
Johan Smit
2004-10-03 05:05:40 UTC
Permalink
Hi,
Every so often, there is discussion about how to install the bde.
It appears many are dissatisfied with the bde, because of this
installation problem.
The latest was an article in the About Delphi newsletter, even with
dire warnings about using only certain installers to install the bde.
I don't understand this.
Some years ago, I came across Bde32.pas, Bde32.zip from
http://www.kestrelsoftware.co.uk, and have been using it ever since.
It is a small freeware component, which bypasses any installation of
the Bde, and works without any problem at all. It was originally
written for Delphi3, but works as well with Delphi5.
All you have to do is include the initialisation of Bde32 at the start
of your program, and include the necessary Bde dll's in a subdirectory
of your app. The Bde32 adds one registry entry if the BDE is not
installed, and there is no problem.
The Bde (version 5.11 if I recall) is stable, included in Delphi, and
with a Paradox database does all I need at this stage. There may be
better databases, but there is no installation problem.
Comments please?
Regards
Johan Smit
Fons
2004-10-03 18:01:37 UTC
Permalink
I hate the BDE but when I try to download it:

----------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, ***@portland.co.uk and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.
More information about this error may be available in the server error log.
----------

Thanks,
Fons.
Post by Johan Smit
Hi,
Every so often, there is discussion about how to install the bde.
It appears many are dissatisfied with the bde, because of this
installation problem.
The latest was an article in the About Delphi newsletter, even with
dire warnings about using only certain installers to install the bde.
I don't understand this.
Some years ago, I came across Bde32.pas, Bde32.zip from
http://www.kestrelsoftware.co.uk, and have been using it ever since.
It is a small freeware component, which bypasses any installation of
the Bde, and works without any problem at all. It was originally
written for Delphi3, but works as well with Delphi5.
All you have to do is include the initialisation of Bde32 at the start
of your program, and include the necessary Bde dll's in a subdirectory
of your app. The Bde32 adds one registry entry if the BDE is not
installed, and there is no problem.
The Bde (version 5.11 if I recall) is stable, included in Delphi, and
with a Paradox database does all I need at this stage. There may be
better databases, but there is no installation problem.
Comments please?
Regards
Johan Smit
Johan Smit
2004-10-04 04:12:56 UTC
Permalink
Post by Fons
----------
Internal Server Error
Hi Fons,
Why do you hate the Bde?
I did not originally get BDE32 from the original site, but from one of
the many, I think it was Torry.

Torry's Delphi Pages
... Fully functional Source: Included. Download: D3, BDE32 Component,
FW, 4 Kb,
10.08.99. By Paul Burrowes. ... Well BDE32 will take care of that for
you. ...
swiss.torry.net/db_bde.htm - 52k - Cached - Similar pages

Regards
Johan Smit
Fons
2004-10-04 16:54:41 UTC
Permalink
Post by Johan Smit
Hi Fons,
Why do you hate the Bde?
Because it needs so much stuff and installation just because I use a simple
dBase or Paradox file. Like I said 2 weeks ago; BPC was excellent because it
was simple and working great.
If you look at how good the software fits in the hardware, the hardware is
always too small. They are not trying to make good software, they are making
things nobody needs but everybody wants.
Microsoft and Borland should not make new software but make the software,
they sell now, stable.
Post by Johan Smit
I did not originally get BDE32 from the original site, but from one of
the many, I think it was Torry.
Torry's Delphi Pages
... Fully functional Source: Included. Download: D3, BDE32 Component,
FW, 4 Kb,
10.08.99. By Paul Burrowes. ... Well BDE32 will take care of that for
you. ...
swiss.torry.net/db_bde.htm - 52k - Cached - Similar pages
I'll try Torry.
Post by Johan Smit
Regards
Johan Smit
Thanks,
Fons.
Fons
2004-10-04 17:30:04 UTC
Permalink
Post by Johan Smit
I did not originally get BDE32 from the original site, but from one of
the many, I think it was Torry.
I could only find one for D3. I do have D7.
Post by Johan Smit
Regards
Johan Smit
Fons.
Johan Smit
2004-10-05 03:30:53 UTC
Permalink
Post by Fons
Post by Johan Smit
I did not originally get BDE32 from the original site, but from one of
the many, I think it was Torry.
I could only find one for D3. I do have D7.
Hi Fons,
Sure, it was originally compiled for D3.
The Bde32.pas file is there, you only have to recompile the package in
the Delphi you are using.
I am using it in D5.
Regards
Johan Smit
Fons
2004-10-05 18:08:08 UTC
Permalink
Post by Johan Smit
Hi Fons,
Sure, it was originally compiled for D3.
The Bde32.pas file is there, you only have to recompile the package in
the Delphi you are using.
I can't find the BDE32.pas. Any sites ?
Post by Johan Smit
I am using it in D5.
Regards
Johan Smit
Thanks,
Fons.
Johan Smit
2004-10-06 04:56:01 UTC
Permalink
Post by Fons
I can't find the BDE32.pas. Any sites ?
unit BDE32;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, Registry;

type
TBDE32 = class(TComponent)
private
FUsingCFG: Boolean;
FLocalShare: Boolean;
FPdxNetDir: String;
FMaxBufSize, FMaxFileHandles, FMemSize, FSharedMemSize: integer;
function GetPaths(var CF: string; var DLLP: string): boolean;
procedure writeToCFG(Item: string; Val: string);
function ReadFromCFG(Item: string; DefStr: string): string;
protected
{ Protected declarations }
public
constructor Create(AOwner:TComponent); override;
published
property LocalShare: boolean read FLocalShare write FLocalShare;
property PdxNetDir: String read FPdxNetDir write FPdxNetDir;
property MaxBufSize: integer read FMaxBufSize write FMaxBufSize;
property MaxFileHandles: integer read FMaxFileHandles write
FMaxFileHandles;
property MemSize: integer read FMemSize write FMemSize;
property SharedMemSize: integer read FSharedMemSize write
FSharedMemSize;
procedure WriteSettings;
procedure ReadSettings;
end;

function FilePos(FileName, What: string; startFrom: integer):integer;

procedure Register;

implementation

constructor TBDE32.Create(AOwner:TComponent);
var
ConfigFile, DLLPath: string;
begin
inherited Create(AOwner);
with TRegistry.create do begin
Rootkey := HKEY_LOCAL_MACHINE;
if not
(OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', false)
and FileExists(ReadString('DLLPATH') + '\idapi32.dll'))
then begin
if GetPaths(ConfigFile, DLLPath) then begin
Rootkey := HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', True);
WriteString('CONFIGFILE01', ConfigFile);
WriteString('DLLPATH', DLLPath);
WriteString('RESOURCE', '0009');
WriteString('SAVECONFIG', 'WIN32');
WriteString('UseCount', '15');
end
else begin
ShowMessage('Please put BDE files in ' +
ExtractFilePath(application.ExeName) + 'BDE');
halt;
end;
end;
Free;
end;
ReadSettings;
end;


procedure TBDE32.ReadSettings;
begin
FPdxNetDir := ReadFromCFG('NET DIR', 'G:\');
FLocalShare := ReadFromCFG('LOCAL SHARE', 'FALSE') = 'TRUE';
FMaxBufSize := StrToInt(ReadFromCFG('MAXBUFSIZE', '2048'));
FMaxFileHandles := StrToInt(ReadFromCFG('MAXFILEHANDLES', '48'));
FMemSize := StrToInt(ReadFromCFG('MEMSIZE', '16'));
FSharedMemSize := StrToInt(ReadFromCFG('SHAREDMEMSIZE', '2048'));
end;

procedure TBDE32.WriteSettings;
begin
if FLocalShare then writeToCFG('LOCAL SHARE', 'TRUE')
else writeToCFG('LOCAL SHARE', 'FALSE');
writeToCFG('NET DIR', FPdxNetDir);
writeToCFG('MAXBUFSIZE', IntToStr(FMaxBufSize));
writeToCFG('MAXFILEHANDLES', IntToStr(FMaxFileHandles));
writeToCFG('MEMSIZE', IntToStr(FMemSize));
writeToCFG('SHAREDMEMSIZE', IntToStr(FSharedMemSize));
end;

procedure TBDE32.writeToCFG(Item: string; Val: string);
Var
CFGFile, TempFile: string;
CFGStream, TempStream: TFileStream;
FoundPos1, FoundPos2: integer;
myBuf: array[0..255] of char;
begin
with TRegistry.create do begin
Rootkey := HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', false);
CFGFile := ReadString('CONFIGFILE01');
Free;
end;
TempFile := CFGFile + '2';
FoundPos1 := FilePos(CFGFile, Item, 0);
if FoundPos1 > 0 then begin
FoundPos2 := FilePos(CFGFile, #0, FoundPos1 + Length(Item) +
3);
CFGStream := TFileStream.Create(CFGFile, fmOpenRead);
TempStream := TFileStream.Create(TempFile, fmOpenWrite or
fmCreate);
TempStream.CopyFrom(CFGStream, FoundPos1 + Length(Item) + 2);
StrPCopy(MyBuf, Val);
TempStream.Write(MyBuf, length(Val));
CFGStream.Seek(FoundPos2 - 1, soFromBeginning);
TempStream.CopyFrom(CFGStream, CFGStream.Size - FoundPos2 +
1);
TempStream.Free;
CFGStream.Free;
end;
DeleteFile(CFGFile);
RenameFile(TempFile, CFGFile);
end;

function TBDE32.ReadFromCFG(Item: string; DefStr: string): string;
Var
CFGFile: string;
FoundPos1, FoundPos2: integer;
MyFile: TextFile;
MyStr: string;
begin
with TRegistry.create do begin
Rootkey := HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', false);
CFGFile := ReadString('CONFIGFILE01');
Free;
end;
if FileExists(CFGFile) then begin
AssignFile(MyFile, CFGFile);
Reset(MyFile);
ReadLn(MyFile, MyStr);
CloseFile(MyFile);
FoundPos1 := Pos(Item, MyStr);
if FoundPos1 > 0 then begin
Delete(MyStr, 1, FoundPos1 + Length(Item) + 2);
foundPos2 := Pos(#0, MyStr);
Result := Copy(MyStr, 0, FoundPos2 + 1);
end
else result := DefStr;
end
else result := DefStr;
end;

function FilePos(FileName, What: string; startFrom: integer): integer;
var
MyStr: string;
MyFile: TextFile;
begin
if FileExists(FileName) then begin
AssignFile(MyFile, FileName);
Reset(MyFile);
ReadLn(MyFile, MyStr);
Delete(MyStr, 1, StartFrom);
Result := StartFrom + Pos(What, MyStr);
CloseFile(MyFile);
end
else result := 0;
end;









function TBDE32.GetPaths(var CF: string; var DLLP: string): boolean;
var
AppDir: string;
begin
AppDir := ExtractFilePath(Application.ExeName);
if FileExists(AppDir + 'idapi32.cfg') then CF := AppDir +
'idapi32.cfg';
if FileExists(AppDir + 'idapi32.dll') then DLLP := Copy(AppDir,
1, Length(AppDir) - 1);

if FileExists(AppDir + 'BDE\idapi32.cfg') then CF := AppDir +
'BDE\idapi32.cfg';
if FileExists(AppDir + 'BDE\idapi32.dll') then DLLP := AppDir +
'BDE';

if FileExists('c:\program files\borland\common
files\BDE\idapi32.cfg') then CF := 'c:\program files\borland\common
files\BDE\idapi32.cfg';
if FileExists('c:\program files\borland\common
files\BDE\idapi32.dll') then DLLP := 'c:\program files\borland\common
files\BDE';

Result := FileExists(CF) and FileExists(DLLP + '\idapi32.dll');
end;

procedure Register;
begin
RegisterComponents('DataAccess', [TBDE32]);
end;

end.
Fons
2004-10-06 19:09:57 UTC
Permalink
Post by Johan Smit
unit BDE32;
interface
...
...
...
end.
Ha, ha !!!

That small ?

Fons.
Fons
2004-10-06 20:21:35 UTC
Permalink
Post by Johan Smit
unit BDE32;
interface
...
...
...
end.
Is it a problem if I change the code to a 'normal' unit and not

RegisterComponents('Data Access', [TBDE32]);

it, but code it like

private BDE32 : TBDE32;

and

BDE32 := TBDE32.Create(Self);

?

Fons.
Johan Smit
2004-10-07 04:14:02 UTC
Permalink
Post by Fons
Is it a problem if I change the code to a 'normal' unit and not
RegisterComponents('Data Access', [TBDE32]);
it, but code it like
private BDE32 : TBDE32;
and
BDE32 := TBDE32.Create(Self);
Hi,
why not?
I never use it otherwise than :

BDE321:= TBDE32.Create(Self);
with BDE321 do begin
ReadSettings;
LocalShare := true;
PDXNetDir := 'C:\';
WriteSettings;
end;
BDE321.Free;
(I am just a bit wary that if I use BDE32 instaed of BDE321, there
might be some conflict with something else defined as BDE32)

See the Readme.txt:

BDE32 component - freeware

The main feature of this component is the ability to run applications
without the BDE installed. Fed up with the error "Cannot load the
DataBase engine" when users run your application on a different
computer. Well BDE32 will take care of that for you. Provided you
have a BDE subdirectory under the application directory, the app can
be run on any machine, locally or through the network. This means
that if you install a progam on a server everyone can double-click on
it and it will run.


Note:

1. Component Installation: as usual.

2. Use: BDE32 has two uses - to run an application without installing
the BDE and to control vital sections of the BDE without the need for
BDEADMIN.EXE and without the user knowing about them.

2.1 How to use BDE32 to run an application without the BDE:
1. Create your executable using your BDE
2. Drop the BDE32 component on your main form
3. Include a subdirectory called BDE with the appropriate
files from your BDE directory - See section 6
4. You can now ship your app - with the BDE subdirectory and
it will set up the BDE for you
5. If you run your app over a network you can do so without
installing the BDE on any client

2.2 How to use BDE32 to control the BDE settings:
1. Drop a BDE32 onto your main form
2. In formcreate do something like this:

with BDE32 do begin
ReadSettings;
LocalShare := true;
PDXNetDir := 'G:\';
WriteSettings;
end;

3. This ensures that you have control over the settings

3. methods: ReadSettings, WriteSettings - gets/puts idapi32.cfg

4. properties: see design time, but these cannot be set until
writesettings is called.

5. Source: Source can be obtained at http://www.kestrelsoftware.co.uk

6. BDE subdirectory: Basically you need to work out the files you need
by trial and error. You need idapi32.cfg, idapi32.dll, bantam.dll,
idr20009.dll and idpdx32.dll for a paradox setup

Loading...