CreateDatabase help

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
keithblows
Posts: 4
Joined: Wed 13 Dec 2006 17:56

CreateDatabase help

Post by keithblows » Wed 13 Dec 2006 18:08

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 14 Dec 2006 12:41

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;

Post Reply