Here is where I'm at with this. I have created a batch file that contains something like this:
@echo off c:\Progra~1\Firebird\Firebird_1_5\bin\gsec -user SYSDBA -password masterkey -add MYUSER -pw MYPASSWORD >From within my Delphi application, I could do the following: - Try to connect to the database as MYUSER. - If connection fails, call the batch file with this code ShellExecute(Handle, 'open', 'MYBATCHFILE.BAT', nil, nil, SW_SHOWNORMAL); - Now connect to the database as MYUSER. Here are the various issues I have with this: - The password is stored in this file unencrypted. Not exactly very secure. Workaround - prompt the user to specify a password. This can be done as follows in the batch file: @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% This creates the user with a unique password. The Delphi application would then prompt the user for the password and store it encrypted in a .ini file. The only problem I see here is that the user is having to enter the password twice the first time the application is run. I suppose as long as they understand they are creating the password the first time and then entering it the second time it will make sense to them. - Another issue is that if Firebird is already installed, they may have changed the sysdba password, in which case calling the batch file from the Delphi app will fail and they won't be able to connect. I suppose if they know how to change the sysdba password I can give them manual instructions on the new user they need to create. - My final issue is the situation where Firebird is not installed in the default location. Any ideas on what I can do about that? How can I call gsec if I do not know where the user is going to install it? - Finally, it would be nice if I could call gsec directly (i.e. directly from Delphi, without having to use the batch file), and that way I can have a nice prompt come up asking for the password (just once as well) without having to have a Command Line prompt come up. Any ideas if / how to do that? I'd appreciate any thoughts / comments on this solution and the associated issues. Thanks, Stephen ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <delphi-db@elists.org> Sent: Friday, August 22, 2008 12:06 PM Subject: RE: Creating a user from within Delphi > gsec is the commandline to administer firebird, what I am suggesting is > to run a command line from within your application, and feed it > parameters. > > MyList='gsec <stuff that makes Firebird dance>'; > > WinExec(PChar(MyList) , SW_SHOWNORMAL); > > I take your points, but I stand by my opinion, users should not control > passwords. > > You should make sure your users understand that if they change, and then > loose the password, that they are stuffed. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Stevio > Sent: 21 August 2008 19:49 > To: Delphi DB > Subject: Re: Creating a user from within Delphi > >> Not answering your question directly. But here's a clue : >> ShellExec + (gsec -user sysdba -password <password> -database >> <databasename>) > > ShellExec is not something I have used before. I have been using > Interbase > Express components in my application. Can I create the user using them? > >> IMHO The dba admin should be controlling passwords, not end users. >> Tails should not wag dogs. > > But you are assuming that there is a dba admin. A lot of the time with > my > application, other than installing Firebird, the end users will not know > > much about Firebird. > > Thanks, > Stephen _______________________________________________ Delphi-DB mailing list Delphi-DB@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-db