Page 1 of 1

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

Posted: 28.11.2013, 11:51
by ciambotto
Tnx

:-)

Fede.

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

Posted: 28.11.2013, 21:07
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

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

Posted: 28.11.2013, 23:56
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.

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

Posted: 30.11.2013, 10:05
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

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

Posted: 03.12.2013, 10:44
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​​"?

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

Posted: 05.12.2013, 09:06
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

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

Posted: 13.12.2013, 16:49
by ciambotto
Ok. :-(

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