[fpc-pascal] SqlDB fails under Windows to create a new Firebird database

Graeme Geldenhuys graeme at geldenhuys.co.uk
Wed Oct 30 13:13:00 CET 2013


Hi,

I created a very simple little application that takes 2 parameters, 
then creates a empty FDB (firebird) database, then runs 4 script files 
to populate the database with default tables and data.

This little console application works perfectly under Linux and 
FreeBSD, but fails under Windows. Currently testing with Win2000 
(32-bit).

Here is the code that causes the AV.

-----------------------

procedure TMyApplication.CreateEmptyDatabase;
var
  LHost: string;
  LDBName: string;
  n: integer;
begin
  n := Pos(':', FDBLocation);
  LHost   := Copy(FDBLocation, 1, n-1);
  LDBName := Copy(FDBLocation, n+1, Length(FDBLocation)-n);

  conn := TIBConnection.Create(self);
  conn.Dialect := 3;
  conn.HostName := LHost;
  conn.DatabaseName := LDBName;
  conn.UserName := 'sysdba';
  conn.Password := 'masterkey';

  writeln('Creating database... ', conn.HostName + ':' + 
conn.DatabaseName);
  conn.CreateDB;
  conn.Connected := True;  // <<-------   This causes the AV under 
Windows
end;
-----------------------

Here is the console output of when I run the program.

-----------------------

c:\programming\m2_system\Scripts>makedb -d 
'127.0.0.1:c:\programming\data\m2_dl_3019.fdb'
Creating database... '127.0.0.1:c:\programming\data\m2_dl_3019.fdb'
exception at 00431BD8:
 : CreateDB :
 -I/O error during "open" operation for file ""
 -database or file exists.
-----------------------


I'm using FPC 2.6.2 32-bit on Windows 2000. Any clues what is wrong? 
And why does this code work on Linux and FreeBSD. Also, even though 
the error mentions the fact that the "database or file exits", that is 
definitely NOT true. There is no existing *.fdb file.

Regards,
  - Graeme -


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131030/9714ca96/attachment.html>


More information about the fpc-pascal mailing list