Delphi InterBase : Change SYSDBA user password through Delphi code

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
InterBase : Change SYSDBA user password through Delphi code
May 2, 2021 by Deepak Kumar Jain

InterBase Introduction​

InterBase is a Relational Database Management System (RDBMS) which is popularly known for its small footprint with almost zero administration requirements and multi-generational architecture.

SYSDBA user​

When someone installs InterBase database , its comes with a default user name as SYSDBA and default password as masterkey .

Initially when InterBase is installed, SYSDBA is the only authorized user on the server which could authorize other users. Since default password is know to everyone , it is advised that DB administrator must change the default password after installation. This password could be changed using IBConsole but sometime there are requirements where this needs to be changed by Delphi code.

in below steps, we will learn that how to use Delphi code to change the SYSDBA password -

1. Start a new VCL Delphi application and put following components on the form
  • TFDIBSecurity
  • TFDPhysIBDriverLink
  • TButton
1619975713257.png

2. Write the following code on button click event
Код:
  FDIBSecurity1.DriverLink := FDPhysIBDriverLink1;
  FDIBSecurity1.Host := '127.0.0.1';
  FDIBSecurity1.UserName := 'SYSDBA';
  FDIBSecurity1.Password := 'masterkey';    // Original password
  FDIBSecurity1.AUserName := 'SYSDBA';      // User for which password needs to be changed
  FDIBSecurity1.APassword := 'N3wPa$$w0rd'; // new password
  FDIBSecurity1.ModifyUser;
With this, you will be able to change the SYDBA user password