Subject Re: [firebird-support] Firebird sysdba account
Author Alexandre Benson Smith
Stevio wrote:
> (I'm using Delphi 5 Professional with Interbase Express 5.)
>
> I have made a new version of my database that is no longer owned by sysdba
> but by my new user which has all the necessary rights over it. I just need a
> little more help now in getting things working with my client application.
>
> I have created a batch file that contains something like this:
> @echo off
> set /p myusername=Specify new password:
> c:\Progra~1\Firebird\Firebird_1_5\bin\gsec -user SYSDBA -password
> masterkey -add MYUSER -pw %myusername%
>
> When the user runs my client application for the first time, the client
> application will not be able to connect because the firebird user account
> "MYUSER" has not been created yet. The client application will therefore run
> the batch file.
>
> When this happens, the command line prompt will come up asking the user to
> "Specify new password: "
>
> Once they do that, the user will be created.
>
> Here are my issues -
> 1) It would be much nicer to ask the user to enter a new password using a
> Delphi form, rather than the command line prompt. How can I feed the
> password they specify into the batch file?
>
> Here is how I currently run the batch file from Delphi:
> ShellExecute(Handle, 'open', 'MYBATCHFILE.BAT', nil, nil, SW_SHOWNORMAL);
>
> 2) If Firebird is not installed in the location I specify in my batch file,
> then my batch file will not work. How can I call gsec if I do not know where
> the user has installed it?
>
> 3) It would be better not to have to use a batch file / command line at all.
> Are there components that allow you to manage Firebird users and do they
> work with Delphi 5 Professional?
>
> Really appreciate your help.
> Thanks,
> Stephen
>
>
>

I don't know Interbase Express, but you probably have some kind of
administrative component that encapsulates the calls to services API. If
Interbase Express does not provide it (wich I think it do) you could
always use the FB API directly.

Regarding using a batch file, you could ask the password in a Delphi
form, and create a batch file on the fly with the supplied password, and
then just run it as you do. Pretty ugly IMHO...

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br