Question

I'm trying to create a Firebird database during runtime. The procedure that I'm using to do this is this one:

procedure CreateDatabase(DBName: String);
var
  IBDatabase1: TIBDatabase;
begin
  IBDatabase1 := TIBDatabase.Create(Self);
  try
    IBDatabase1.DatabaseName := ChangeFileExt(DBName, '.fdb');
    IBDatabase1.Params.Add('USER ''SYSDBA''');
    IBDatabase1.Params.Add('PASSWORD ''masterkey''');
    IBDatabase1.Params.Add('PAGE_SIZE 4096');
    IBDatabase1.Params.Add('DEFAULT CHARACTER SET WIN1252');
    IBDatabase1.CreateDatabase;
  finally
    IBDatabase1.Free;
  end;
end;

I've achieved this without problems in any little project that I create to teste this function. However, if I try to run this code in the same machine, same Delphi, same everything, except that it is a different (and quite big) project, I get the following error on the IBDatabase1.CreateDatabase line:

First chance exception at $7579B9BC. Exception class EIBInterBaseError with message 'unavailable database'. Process xxx.exe (4144)

Anybody has any clues about this one? Maybe some way to debug this properly?

Thanks in advance.

EDIT

It seems to be something in my project file. I've managed to generate a new one and the problem is gone, but I'm afraid of being bitten by this in the future. What could possibilly cause this?

Was it helpful?

Solution

It wasn't my project file. It was an old GDS32.dll that was dropped in the same directory as the executable. Removing it solved the issue. Hope this might help someone with the same problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top