Subject | Re: Changing SYSDBA password from Delphi application |
---|---|
Author | paulwesson |
Post date | 2005-02-24T13:14:35Z |
> >How to change SYSDBA password from Delphi application?I just shell out and run the GSEC command. If flashes the DOS window,
> >
> >I have IBX and FIBPlus components to connect to Firebird.
but hey, it works.
sCmd := '-database ' + txtIP.Text + ':' + txtSecurityDB.Text + ' -user
sysdba -password ' + txtPassword.Text + ' -modify sysdba -pw ' +
txtPW1.Text;
// sToolsPath is the location of GSEC
ExecuteCommand('gsec', sCmd, sToolsPath);
procedure TForm1.ExecuteCommand(sCommand: String; sParameters: String;
sPath: String);
var
SEInfo: TShellExecuteInfo;
ExitCode: DWORD;
i: Integer;
begin
FillChar(SEInfo, SizeOf(SEInfo), 0);
SEInfo.cbSize := SizeOf(TShellExecuteInfo);
with SEInfo do begin
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Application.Handle;
lpFile := PChar(sCommand);
lpParameters := PChar(sParameters);
lpDirectory := PChar(sPath);
nShow := SW_SHOWNORMAL;
end;
if ShellExecuteEx(@SEInfo) then begin
repeat
Application.ProcessMessages;
GetExitCodeProcess(SEInfo.hProcess, ExitCode);
until (ExitCode <> STILL_ACTIVE) or
Application.Terminated;
end
else ShowMessage('Error!');
for i := 1 to 100 do
Application.ProcessMessages;
end;