TIBCConnection properties

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
BennieC
Posts: 11
Joined: Fri 11 Feb 2011 17:56

TIBCConnection properties

Post by BennieC » Tue 08 Jan 2013 18:19

Hi
I am a new user of IBDAC and would like to create a Firebird database programmatically. From searching your forums I came up with (After placing components IBCConnection and IBCScript on the form)

Code: Select all

  IBCScript1.Connection := IBCConnection1;
  IBCScript1.NoPreconnect := True;
  IBCScript1.SQL.Text :=
    'CREATE DATABASE ''D:\Data\test.fdb'' ' +
    'USER ''SYSDBA'' PASSWORD ''masterkey'' PAGE_SIZE 16384 DEFAULT CHARACTER SET UTF8;';
  IBCScript1.Execute;
I know it sounds stupid but what do I enter as Server property on the TIBCConnection component. I have a Firebird server on port 3050 and an Interbase Server on port 3053. I do not believe the servers have names and where do I enter the port number that the server is listening on? Also, how does the above know that it is a Firebird database that is to be created.
Is there any documentation that could assist me in this?
Regards

AndreyZ

Re: TIBCConnection properties

Post by AndreyZ » Wed 09 Jan 2013 11:39

Hello,

You can create a database using the TIBCConnection.CreateDatabase method. Here is a code example:

Code: Select all

IBCConnection.Database := 'database_name.fdb';
IBCConnection.ClientLibrary := 'fbclient.dll'; // working with Firebird
IBCConnection.Params.Clear;
IBCConnection.Params.Add('USER ''SYSDBA''');
IBCConnection.Params.Add('PASSWORD ''masterkey''');
IBCConnection.Params.Add('PAGE_SIZE 16384');
IBCConnection.Params.Add('DEFAULT CHARACTER SET UTF8');
IBCConnection.CreateDatabase;
You can use either this way or the way you wrote above, they are identical.
You should specify in the TIBCConnection.Server property either a DNS name or IP address of the computer where Firebird server resides. For example, you can set TIBCConnection.Server to 'localhost' or '127.0.0.1' if Firebird is installed and run on the local computer.

BennieC
Posts: 11
Joined: Fri 11 Feb 2011 17:56

Re: TIBCConnection properties

Post by BennieC » Wed 09 Jan 2013 12:58

How does the TIBCConnection know whether I want to connect to the Interbase or the Firebird server - purely by the clientlibrary parameter or must I specify the port somewhere?

AndreyZ

Re: TIBCConnection properties

Post by AndreyZ » Wed 09 Jan 2013 14:09

You should specify the port in the TIBCConnection.Port property. Here is a code example:

Code: Select all

IBCConnection.Port := '3050';

Post Reply