Page 1 of 1

Firebird Embedded Database on CD-ROM

Posted: 02.04.2006, 06:15
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

Posted: 06.09.2006, 14:23
by designshouse
I have the same problem. Did you solve it?

Re: Firebird Embedded Database on CD-ROM

Posted: 06.09.2006, 16:56
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

Posted: 07.09.2006, 07:48
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

Posted: 08.09.2006, 14:11
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