Firebird Embedded Database on CD-ROM

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
doug4
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 02.04.2006, 05:43

Firebird Embedded Database on CD-ROM

Post by doug4 »

Is there a way to use Zeos DBO to access a Firebird embedded database on a CD-ROM that has not been set to read_only mode with gfix?

If I burn the necessary embedded Firebird files to the CD along with
my program and use gfix to set my database to read_only mode, my
application will run off of the CD. However, I would like my end
users to be able to burn their own CDs but I do not want to give them
the sysdba username and password or the database owner username and
password which is required by gfix.

Thank you,
doug4
designshouse
Fresh Boarder
Fresh Boarder
Posts: 20
Joined: 21.11.2005, 10:13
Location: Pieštany
Contact:

Post by designshouse »

I have the same problem. Did you solve it?
doug4
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 02.04.2006, 05:43

Re: Firebird Embedded Database on CD-ROM

Post by doug4 »

designshouse wrote:I have the same problem. Did you solve it?
I found that gfix on an embedded firebird database needs a valid username but does not need a valid password. I'm using the following Delphi function. This works even though this is not a valid password for sysdba.

Code: Select all

function TFormHearingTransfer.MDOMakeDatabaseReadOnly(DatabaseName1 : String) : Boolean;
begin
  Result := false;

  try
    DataModule3.ZConnection3.Connected := false;

    with DataModule3.MDOConfigService1 do
      begin
        Active := false;
        DatabaseName := DatabaseName1;
        ServerName := GetComputerNetName;   // ServerName := '';
        LoginPrompt := false;
        Protocol := Local;
        Params.Clear;
        Params.Add('user_name=sysdba');
        Params.Add('password=xyz123');
        Attach;   // Active := true;

        if Active then
          begin
            SetReadOnly(true);
            Detach;   // Active := false;
          end;
      end;   // with MDOConfigService1 do

    with DataModule3.MDODatabase1 do
      begin
        Connected := false;
        DatabaseName := DatabaseName1;
        LoginPrompt := false;
        Params.Clear;
        Params.Add('user_name=sysdba');
        Params.Add('password=xyz123');
        Connected := true;
        if Connected then
          begin
            with DataModule3.MDODatabaseInfo1 do
              begin
                Database := DataModule3.MDODatabase1;
                if ReadOnly = 1 then
                  begin
                    Result := true;
                  end;
              end;
              
            Connected := false;
          end;
      end;   // with MDODatabase1 do

  except on e:exception do
      begin
        MessageDlg('Exception in function TFormHearingTransfer.MDOMakeDatabaseReadOnly: ' + e.ClassName + CRLF + e.message, mtError, [mbOK], 0);
      end;
  end;   // try

  DataModule3.MDODatabase1.Connected := false;
    
  if not Result then
    MessageDlg('Failed to make database ' + DatabaseName1 + ' read only!', mtError, [mbOK], 0);
end;
- doug4
designshouse
Fresh Boarder
Fresh Boarder
Posts: 20
Joined: 21.11.2005, 10:13
Location: Pieštany
Contact:

Post by designshouse »

Thank you for your quick answer.

I think I am stupid because I can not understand this source code.
Please can you send me a demo application?
My email : is@tsu.sk

P.S. sorry for my english
doug4
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 02.04.2006, 05:43

Post by doug4 »

designshouse wrote:Thank you for your quick answer.

I think I am stupid because I can not understand this source code.
Please can you send me a demo application?
My email : is@tsu.sk

P.S. sorry for my english
The example I provided is Delphi. Please try using gfix as follows using a valid username (SYSDBA) but an invalid password. It should work.

Code: Select all

gfix -mode read_only -user sysdba -password xyz123 dbserver:/db/mydb.fdb
-doug4
Post Reply