Page 1 of 1

CreateDatabase help

Posted: Wed 13 Dec 2006 18:08
by keithblows
I need to create a new Firebird V2 database using IBDAC, for a clean installation of Firebird (i.e. the system does not contain any Firebird databases, other than security2.fdb).

Could you advise if this is possible as I cannot connect to Firebird unless I specify something for TIBConnection.Database...?

I also can’t see how to specify the database name to be created in TIBConnection.CreateDatabase method?

IBCConnection1.Params.Add('user_name=sysdba');
IBCConnection1.Params.Add('password=masterkey');
IBCConnection1.Params.Add('lc_ctype=WIN1252');
IBCConnection1.Params.Add('PAGE_SIZE=4096');
IBCConnection1.Username := 'SYSDBA';
IBCConnection1.Password := 'masterkey';
IBCConnection1.Server := '127.0.0.1';
IBCConnection1.CreateDatabase;


Kind Regards,
Keith Blows

Posted: Thu 14 Dec 2006 12:41
by Plash
You don't need to connect to a database before you call the TIBCConnection.CreateDatabase method. Assign a dababase name to the TIBCConnection.Database property. Set the database parameters using the same syntax as in SQL statement CREATE DATABASE. If you use an embedded server set also the TIBCConnection.ClientLibrary property. For example:

Code: Select all

  IBCConnection.Database := ;
  IBCConnection.ClientLibrary := ;
  IBCConnection.Params.Clear;
  IBCConnection.Params.Add('USER ''SYSDBA''');
  IBCConnection.Params.Add('PASSWORD ''masterkey''');
  IBCConnection.Params.Add('PAGE_SIZE 4096');
  IBCConnection.Params.Add('DEFAULT CHARACTER SET WIN1252');
  IBCConnection.CreateDatabase;