[fpc-pascal] Firebird embedded x64: strange error code when database not found

Jim hakkie42 at gmail.com
Sat Jun 19 12:32:58 CEST 2010


Hi all,

Still getting Firebird embedded to workg correctly.
Seems like I get improper error messages...

I seem to have 32 bit working; now I'm testing 64 bit functionality:
Windows Vista
Free Pascal Compiler version 2.4.1 [2010/06/06] for x86_64
Firebird 2.1.3.18185

See
http://bitbucket.org/jb/flocate/issue/5/cant-get-embedded-firebird-to-work
attachment fbembedtest64_19June.zip
for the full code (just rename the fbembed.fdb to something else to
simulate a database not found problem.

Running code like this (abbreviated):
  UseEmbeddedFirebird := true;
  FDBHost := ''; //empty for embedded
  FDBDatabase := 'FBEMBED.FDB';
  FDBUser := 'SYSDBA';
  FDBPassword := 'masterkey';
  FConnection := TIBConnection.Create(nil);
  if FConnection.Connected = False then
    try
      //connect immediately
      Writeln(stderr, 'Debug: ', DateTimeToStr(Now),
        ': SetUp: Connecting to database: ');
      FConnection.HostName := FDBHost;
      FConnection.DatabaseName := FDBDatabase;
      FConnection.Username := FDBUser;
      FConnection.Password := FDBPassword;
      FConnection.Charset := 'NONE'; //we're only passing numbers anyway
      FConnection.Open;
    except
      on E: Exception do
      begin
        Writeln(stderr, 'Debug: ', DateTimeToStr(Now),
          ': Error connecting to embedded database/setting up
transaction. Technical details: ',
          E.ClassName, '/', E.Message);
        // Clean up
        FConnection.Free;
        raise; //Escalate exception
      end; //E: Exception
    end; //except

I get this kind of output (stdout/stderr; compiled with -g -gl -gh):
Debug: 19-6-2010 12:08:13: Starting database setup:
Debug: 19-6-2010 12:08:13: SetUp: Connecting to database:
Debug: 19-6-2010 12:08:13: Error connecting to database/setting up
transaction.
Technical details: EControlC/Control-C hit
Marked memory at $000000000119EAB0 invalid
Wrong signature $A7827A0E instead of 1E7FBA36
  $0000000100015644
  $0000000100015752
  $000000010000A9F5
  $000000010003B066  TFLOCATEDB__CREATE,  line 245 of fbembeddb.pp
  $0000000100001A61  TFBEMBEDTEST__CREATE,  line 100 of fbembedtest.pas
  $0000000100001DB2  main,  line 128 of bembedtest.pas
  $0000000100013101

On 32 bit, I get a proper exception instead of EControl/Control-C hit.

If you do use the proper database and allow the code to continue, I also
get these Control-C reports when deliberately generating database errors
later on in the code: snippet from stderr/stdout:
*** Insert number 5 again. This should fail because of the unique index.
*** We should get a generic database error.
Debug: 19-6-2010 12:17:08: SaveNumber: going to add parameters for
insert query
Debug: 19-6-2010 12:17:08: Error running insert query. Technical
details: Control-C hit

What am I doing wrong?
-- 
Regards,

jb



More information about the fpc-pascal mailing list