Subject | RE: [firebird-support] 3.x - Check if DB exist using alias |
---|---|
Author | Zoran |
Post date | 2019-08-05T13:58:14Z |
What Dimitry said, or you can try this:
function _GetAliasDBFName(alias): string;
var
sl: TStringList;
begin
result := '';
sl := TStringList.Create;
try
sl.LoadFromFile('C:\Program Files\Firebird\Firebird_3_0\databases.conf');
result := sl.Values[alias];
finally
sl.Free;
end;
end;
Simply call _ GetAliasDBFName and pass your alias name as a param. Problem might arise if FB team chooses to change name of database.conf file, or re-allocate it.
From: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Sent: Monday, August 5, 2019 8:06 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] 3.x - Check if DB exist using alias
I'm using Delphi.
Which is the best way to check if a database exist if my connection is alias based?
I have to try to connect and manage response?
Is there another way?
Fabio Codebue
P-SOFT di Codebue Fabio
Via Nuova n. 9 - 24060 Tavernola B.sca (BG)
P.I. 03624950162
C.F. CDBFBA72A11C618T
Mobile: +39.348.3515786
Fax: +39.030.5100306
Web: <http://www.p-soft.biz/> http://www.p-soft.biz
pec: amministrazione@pec.p-soft.biz <mailto:amministrazione@pec.p-soft.biz>
cod.intermediario SDI: KRRH6B9
[Non-text portions of this message have been removed]
function _GetAliasDBFName(alias): string;
var
sl: TStringList;
begin
result := '';
sl := TStringList.Create;
try
sl.LoadFromFile('C:\Program Files\Firebird\Firebird_3_0\databases.conf');
result := sl.Values[alias];
finally
sl.Free;
end;
end;
Simply call _ GetAliasDBFName and pass your alias name as a param. Problem might arise if FB team chooses to change name of database.conf file, or re-allocate it.
From: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Sent: Monday, August 5, 2019 8:06 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] 3.x - Check if DB exist using alias
I'm using Delphi.
Which is the best way to check if a database exist if my connection is alias based?
I have to try to connect and manage response?
Is there another way?
Fabio Codebue
P-SOFT di Codebue Fabio
Via Nuova n. 9 - 24060 Tavernola B.sca (BG)
P.I. 03624950162
C.F. CDBFBA72A11C618T
Mobile: +39.348.3515786
Fax: +39.030.5100306
Web: <http://www.p-soft.biz/> http://www.p-soft.biz
pec: amministrazione@pec.p-soft.biz <mailto:amministrazione@pec.p-soft.biz>
cod.intermediario SDI: KRRH6B9
[Non-text portions of this message have been removed]