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

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

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

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

Postby ciambotto » 28.11.2013, 11:51

Tnx

:-)

Fede.

marsupilami
Gold Boarder
Gold Boarder
Posts: 581
Joined: 17.01.2011, 14:17

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

Postby marsupilami » 28.11.2013, 21:07

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)

Postby ciambotto » 28.11.2013, 23:56

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
Gold Boarder
Gold Boarder
Posts: 581
Joined: 17.01.2011, 14:17

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

Postby marsupilami » 30.11.2013, 10:05

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)

Postby ciambotto » 03.12.2013, 10:44

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
Gold Boarder
Gold Boarder
Posts: 581
Joined: 17.01.2011, 14:17

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

Postby marsupilami » 05.12.2013, 09:06

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)

Postby ciambotto » 13.12.2013, 16:49

Ok. :-(

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


Return to “Firebird”

Who is online

Users browsing this forum: No registered users and 1 guest