Board index » delphi » Setting just the Server Property in the BDE Config file at runtime

Setting just the Server Property in the BDE Config file at runtime

Does anyone have any code to share that shows how to set the user's
IDAPI32.CFG file to change just one property?

I want to just alternate between two server names..

Any code or direction would be greatly appreciated!

Thanks!

Rkr

--
                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer / Analyst             .
. TVisualBasic:=class(None);              .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) pacbell (dot) net .
. or reidr (at) autobytel (dot) com       .
-------------------------------------------

 

Re:Setting just the Server Property in the BDE Config file at runtime


Reid

What we did for supporting multiple servers was to not use Aliases at all.
Instead set the parameters directly for the database objects.

When you bring up the database editor you can either enter an alias or
enter a driver  name and then the parameters for that driver. For example
we were working with Sybase so the default parameters are:

DATABASE NAME=
SERVER NAME=SYB_SERVER
USER NAME=MYNAME
OPEN MODE=READ/WRITE
SCHEMA CACHE SIZE=8
BLOB EDIT LOGGING=
LANGDRIVER=
SQLQRYMODE=
SQLPASSTHRU MODE=SHARED AUTOCOMMIT
DATE MODE=0
SCHEMA CACHE TIME=-1
MAX QUERY TIME=300
MAX ROWS=-1
BATCH COUNT=200
ENABLE SCHEMA CACHE=FALSE
SCHEMA CACHE DIR=
HOST NAME=
APPLICATION NAME=
NATIONAL LANG NAME=
ENABLE BCD=FALSE
TDS PACKET SIZE=512
BLOBS TO CACHE=64
BLOB SIZE=32
PASSWORD=

At runtime you can use :

Datamodule2.Database1.connected := False;
Datamodule2.Database1.params[1] := 'SERVER NAME=' + aServerName;
Datamodule2.Database1.params[2] := 'USER NAME=' + aUserName;
Datamodule2.Database1.params[23] := 'PASSWORD=' + aPassword
Datamodule2.Database1.connected := True;

Anyway you get the idea.

It works just fine.

Andy
        atjen...@bellatlantic.net

Reid Roman <rkro...@pacbell.net> wrote in article
<34C49DFF.A39F2...@pacbell.net>...

Quote
> Does anyone have any code to share that shows how to set the user's
> IDAPI32.CFG file to change just one property?

> I want to just alternate between two server names..

> Any code or direction would be greatly appreciated!

> Thanks!

> Rkr

> --
>                    \|||/
>                    /'^'\
>                   ( 0 0 )
> --------------oOOO--(_)--OOOo--------------
> . Reid Roman                                 .
> . Delphi Programmer / Analyst                .
> . TVisualBasic:=class(None);                 .
> . May the Source be With You                 .
> -------------------------------------------
> . Auto-By-Tel (http://www.autobytel.com)  .
> . Irvine, CA U.S.A                           .
> . E-Mail : rkroman (at) pacbell (dot) net .
> . or reidr (at) autobytel (dot) com          .
> -------------------------------------------

Re:Setting just the Server Property in the BDE Config file at runtime


Quote
Reid Roman wrote:
> Does anyone have any code to share that shows how to set the user's
> IDAPI32.CFG file to change just one property?

> I want to just alternate between two server names..

> Any code or direction would be greatly appreciated!

> Thanks!

There is a free/shareware component on the Delphi Super Page which
allows you to manipulate the DBE configuration programtically. It is in
the DataBase Section of the components page.
--
Norman McFarlane
NMC Systems cc
PO Box 1199
FLORIDA HILLS
1716
+27 11 477-4034 (Telephone)
+27 11 477-0225 (Fax)
normanm@#global.co.za

Other Threads