InterBase : Change SYSDBA user password through Delphi code

InterBase : Change SYSDBA user password through Delphi code

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

image.png

  1. 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.

Please comment below to discuss more about this.