Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing BDE Settings

1,070 views
Skip to first unread message

Jesse Castleberry

unread,
Feb 23, 2000, 3:00:00 AM2/23/00
to
In order to make network installation of our BDE enabled application easier,
I want to try to make an install routine that would automatically change
some of the BDE settings. These are:

1. The LOCAL SHARE setting needs to be set to TRUE.
2. The NET DIR needs to be set to a particular Drive/directory.
3. I may (in some cases) need to add an alias with a path setting.

How can I do these things from within our Delphi 3/5 application?

Thanks,
-= Jesse =-
http://www.msdlg.com
http://www.davinci-mims.com

Faruk Kaynaklı

unread,
Feb 24, 2000, 3:00:00 AM2/24/00
to
Short time ago I have the same problem and now solved by group members. Here
is answers...
Best Regards...
Faruk Kaynakli

>I can change BDE configuration in BDE Administrator. How can I change these
>settings in my program. (for example: Net Dir attribute at
>Configuration\Drivers\Native\Paradox
>or
>Local Share attribute at Configuration\System\Init)

>Best Regards...
>Faruk KAYNAKLI
>fkay...@yahoo.com
>fk1...@bbm.com.tr

> SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');

>It should be:
>SetConfigValue('\DRIVERS\PARADOX', 'NET DIR', 'c:\');

>Gert


>See the examples for DbiOpenCfgInfoList at
>www.borland.com/devsupport/bde/bdeapiex.

--
>Bill

>Bill Todd (TeamB)
>(TeamB cannot respond to questions received via email)

On Wed, 19 Jan 2000 10:13:35 +0200, "Faruk KAYNAKLI"
<fkay...@yahoo.com> wrote:

>I can change BDE configuration in BDE Administrator. How can I change these
>settings in my program. (for example: Net Dir attribute at
>Configuration\Drivers\Native\Paradox
>or
>Local Share attribute at Configuration\System\Init)

Here is an example for Local Share:

procedure SetLocalShare;
const
InitPath = '\System\Init';
LocalShareDesc = 'LOCAL SHARE';
LocalShareValue = 'TRUE';
var
Cursor: HDbiCur;
ConfigDesc: CfgDesc;
begin
Check(DbiInit(nil));
Check(DbiOpenCfgInfoList(nil, dbiReadWrite, cfgPersistent,
InitPath, Cursor));
try
while DbiGetNextRecord(Cursor, dbiNoLock, @ConfigDesc, nil) =
0 do
begin
if StrIComp(ConfigDesc.szNodeName, LocalShareDesc) = 0 then
begin
if StrIComp(ConfigDesc.szValue, LocalShareValue) <>
0 then
begin
Check(DbiGetRecord(Cursor, dbiWriteLock,
@ConfigDesc, nil));
StrPCopy(ConfigDesc.szValue, LocalShareValue);
Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
end;
end;
end;
finally
DbiCloseCursor(Cursor);
DbiExit;
end;
end;

Note: this will only take effect after you restart your application
*and* after all BDE-using applications are closed.

Net Dir is similar, but can also be set for your application only via
TSession (which is the preferred way, IMHO).

HTH,

Jan
That work fine with your example

SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');

I try it with

SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');

and the error $2208 occurs. Why? Can anybody help me????
I need to change the Net Dir Parameter.

Andreas

Gert Kello wrote:

> > I can change BDE configuration in BDE Administrator. How can I change
> these
> > settings in my program. (for example: Net Dir attribute at
> > Configuration\Drivers\Native\Paradox
> > or
> > Local Share attribute at Configuration\System\Init)
> For changing config params You may use following code:
>
> <<<begin>>>
> procedure SetConfigValue(sNode, sItem, sValue: string);
> var
> hCur: hDBICur;
> Config: CFGDesc;
> rslt: DBIResult;
> temp: array[0..255] of char;
> begin
> file://Open the idapi.cfg and read details for the node given
> Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
> StrPCopy(temp, sNode), hCur));
> try
> file://Go to the top of the node.
> Check(DbiSetToBegin(hCur));
> file://Go thru each leaf in the node until we come to the required
item.
> repeat
> file://Don't use check here. We neet the result
> rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
> if (rslt = DBIERR_NONE) then begin
> if StrPas(Config.szNodeName) = sItem then begin
> file://Modify the record.
> StrPCopy(Config.szValue, sValue);
> Check(DbiModifyRecord(hCur, @Config, True));
> Break;
> end;
> end
> else file://There was an error
> if (rslt <> DBIERR_EOF) then
> Check(rslt);
> until (rslt <> DBIERR_NONE);
> finally
> file://Close the Cursor
> if (hCur <> nil) then
> Check(DbiCloseCursor(hCur));
> end;
> end;
> <<<end>>>
>
> and setting Local Share with it:
> <<<<begin>>>>
> Check(dbiInit(nil));
> try
> // ********* SET THE LOCAL SHARE PROPERTY TO TRUE *********
> SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
> finally
> Check(dbiExit);
> end;
> <<<<end>>>>
>
> Gert
> I can change BDE configuration in BDE Administrator. How can I change
these
> settings in my program. (for example: Net Dir attribute at
> Configuration\Drivers\Native\Paradox
> or
> Local Share attribute at Configuration\System\Init)
For changing config params You may use following code:

<<<begin>>>
procedure SetConfigValue(sNode, sItem, sValue: string);
var
hCur: hDBICur;
Config: CFGDesc;
rslt: DBIResult;
temp: array[0..255] of char;
begin
file://Open the idapi.cfg and read details for the node given
Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
StrPCopy(temp, sNode), hCur));
try
file://Go to the top of the node.
Check(DbiSetToBegin(hCur));
file://Go thru each leaf in the node until we come to the required
item.
repeat
file://Don't use check here. We neet the result
rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
if (rslt = DBIERR_NONE) then begin
if StrPas(Config.szNodeName) = sItem then begin
file://Modify the record.
StrPCopy(Config.szValue, sValue);
Check(DbiModifyRecord(hCur, @Config, True));
Break;
end;
end
else file://There was an error
if (rslt <> DBIERR_EOF) then
Check(rslt);
until (rslt <> DBIERR_NONE);
finally
file://Close the Cursor
if (hCur <> nil) then
Check(DbiCloseCursor(hCur));
end;
end;
<<<end>>>

and setting Local Share with it:
<<<<begin>>>>
Check(dbiInit(nil));
try
// ********* SET THE LOCAL SHARE PROPERTY TO TRUE *********
SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
finally
Check(dbiExit);
end;
<<<<end>>>>

Gert

Faruk,

you can use the GetConfigParams and ModifyDriver. They´re a TSession´s
methods.

Odilon Araújo
SoftSite Tecnologia
odi...@softsite.com.br

Faruk KAYNAKLI <fkay...@yahoo.com> wrote in message
news:863r5o$fi...@bornews.borland.com...
> I can change BDE configuration in BDE Administrator. How can I change
these
> settings in my program. (for example: Net Dir attribute at
> Configuration\Drivers\Native\Paradox
> or
> Local Share attribute at Configuration\System\Init)
>
> Best Regards...
> Faruk KAYNAKLI
> fkay...@yahoo.com
> fk1...@bbm.com.tr
>
>

Joe Real

unread,
Feb 26, 2000, 3:00:00 AM2/26/00
to
Here is a trick that I use. The following code is a headache free automatic
setting of the BDE so that it will set the Local Share to true and the
number of handles for MaxFiles should be greater than 80. You can do the
same style for the NET DIR directory.

1) Test if BDEOK.JGR file exists (you can use any unique file for that
matter). This is the signature file which is automatically created once the
BDE has been tested or set properly to the required settings. The first time
the program is executed on the machine, this file do not exist yet, and it
will let my program know that the BDE settings have not been tested.
2) If the signature file did not exist, then test the BDE and set it
correctly.
3) If settings to the BDE were made, then exit the program so that the BDE
will be reinitialized when you rerun your program, of course you must warn
the user to run your program again as in this sample.

Attach the following code to the form create event of your main form:

Remember to have

USES ...., BDE;


procedure TForm1.FormCreate(Sender:TObject);
var BDEOK:boolean; LocalShareValue:string; MaxFiles:integer;
BDEOKFile:TextFile;
ProgramDirPath:String;
begin
ShortDateFormat:='MM/DD/YYYY'; ///forcing 4-digit Y2K dates
Application.UpdateFormatSettings:=False; ///preventing users regional
setting updating
///in
case they change it outside of program
ProgramDirPath:=ExtractFilePath(Application.ExeName);
if not fileexists(ProgramDirPath+'BDEOK.JGR') then begin
ShowMessage('The program will check the settings of the Borland Database
Engine for the first time.');
BDEOK:=True;
Check(DbiInit(nil));
try

MaxFiles:=StrToInt(Trim(GetConfigParameter('\SYSTEM\INIT\;MAXFILEHANDLES',ni
l)));
LocalShareValue:=UpperCase(GetConfigParameter('\SYSTEM\INIT\;LOCAL
SHARE',nil));
if MaxFiles<80 then begin
SetConfigParameter('\SYSTEM\INIT\;MAXFILEHANDLES','99');
BDEOK:=False;
end;
if LocalShareValue='FALSE' then begin
SetConfigParameter('\SYSTEM\INIT\;LOCAL SHARE','TRUE');
BDEOK:=False;
end;
AssignFile(BDEOKFile,'BDEOK.JGR');
Rewrite(BDEOKFile);
Writeln(BDEOKFile,'MaxFileHandles: old = '+IntToStr(MaxFIles)+', new =
99');
Writeln(BDEOKFile,'Local Share : old = '+LocalShareValue +', new =
TRUE');
Writeln(BDEOKFIle,'Date/Time Corrected: '+DateTimeToStr(Now));
Closefile(BDEOKFile);
if BDEOK then begin
ShowMessage('BDE Settings are correct. Press OK to continue.');
end else begin
ShowMessage('BDE Settings have been configured for
'+Application.Title+
' The application will be closed. Please reload
'+Application.Title+' for the new settings to take effect.');
Application.Terminate;
end;
finally
Check(DBiExit);
end;
end;
end;

Jesse Castleberry <Je...@msdlg.com> wrote in message
news:891o9m$83...@bornews.borland.com...

ghong...@gmail.com

unread,
Jun 9, 2014, 10:54:11 PM6/9/14
to
2. SetConfigValue('\Drivers\PARADOX\INIT','NET DIR', 'd:\');


Jesse Castleberry於 2000年2月23日星期三UTC+8下午4時00分00秒寫道:
0 new messages