How to create an Alias at runtime? (Delphi/Lazarus)

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ciambotto
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 28.11.2013, 11:19

How to create an Alias at runtime? (Delphi/Lazarus)

Post by ciambotto »

Tnx

:-)

Fede.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1935
Joined: 17.01.2011, 14:17

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by marsupilami »

Hello Fede,

what do you try to acomplish? What kind of alias do you want to create at runtime? Which database system do you use?
Best regards,

Jan
ciambotto
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 28.11.2013, 11:19

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by ciambotto »

ok.

I have a Firebird DB rel.2.5.2.
I'm developing a software that it will connects to DB using an alias in Firebird.
The alias's name will be decide by user, so I will be must create it at runtime everytime the user will create a new.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1935
Joined: 17.01.2011, 14:17

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by marsupilami »

Hello ciambotto,

to create a firebird alias, you would have to modify the file aliases.conf in the firebird server directory. But to be able to modify that file, your program usually would have to run with administrator privileges. Are you sure, that is what you want?
If you only want to store connection informaton (server name, database, username, apssword, ...) you could simply store an ini file in the users profile that holds this information for you?
Best regards,

Jan
ciambotto
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 28.11.2013, 11:19

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by ciambotto »

marsupilami wrote:Hello ciambotto,

to create a firebird alias, you would have to modify the file aliases.conf in the firebird server directory. But to be able to modify that file, your program usually would have to run with administrator privileges. Are you sure, that is what you want?
Jan

This means that even if I had Administrator privileges, there is no method "CreateFirebirdDBAlias​​"?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1935
Joined: 17.01.2011, 14:17

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by marsupilami »

Hello ciambotto,

no, there is no method like CreateFirebirdDBAlias​​. The aliases.conf file is a simple text file, formed of lines like:
databasealias = /path/to/database.fdb
for Unix / Linux or
databasealias = C:\path\to\database.fdb
for Windows. It should be simple to add lines as you need them. Maybe even by utilizing TIniFile.
Best regards,

Jan
ciambotto
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 28.11.2013, 11:19

Re: How to create an Alias at runtime? (Delphi/Lazarus)

Post by ciambotto »

Ok. :-(

so where do I post a request to implement a method like "CreateFirebirdDBAlias​​"?
Post Reply