Subject Using Alias with Firebird Embedded
Author Marv Cook
Hi all,



This may be old hat to you all, but here is what I have found.



1. The real path must be used in the Aliases.config

#

# List of known database aliases

# ------------------------------

#

# Examples:

#

# dummy = c:\data\dummy.fdb

#

Stocks = d:\delphidev\stocks\STOCKSDB.FDB

2. The IBO connection string is just the Alias Name - no server
name or colon attached



I use an INI file to store the connection information

[Database]

Alias=Stocks

Server=

Note that server field is blank, by just changing this entry; I can
point to another server on the net.



Finally, I use the following Procedure to connect:



Procedure OpenFBAlias(vIBC : TIB_Connection;vUserName,vPassword :
string);

var f : TIniFile;

s,csServer: string;

begin

vIBC.Connected := false;

f := TIniFile.Create(DBiniName);

try

begin

s := f.ReadString('Database','Server','**');

if s <> '**' then

begin

csServer := s;

if Length(csServer) > 0 then csServer := csServer + ':';

s := f.ReadString('Database','Alias','');

try

vIBC.Database := csServer + s;

VIBC.UserName := vUserName;

vIBC.Password := vPassword;

vIBC.Connected := True;

except

end;

end;

end;

finally

f.Free;

end;

end;





(Suggestions for improvement are encouraged:-))



Marv





[Non-text portions of this message have been removed]