Subject Re: [IBO] New to IBObjects.
Author Helen Borrie
At 12:24 PM 06-09-01 +1000, you wrote:

> >Scripts are not used for connecting to the database - they are run from an active connection to the server >and are used for creating metadata (DDL scripts) or performing batch operations on a database (DML >scripts).
>As stated above - I am working from Tutorial 1 model in Tutorials/Basic Tutorials which makes use of scripts and accordingly theTIB_Script Object.
>Here is some code for opening your database connection in FormCreate ...
>procedure TfrmMyForm.FormCreate(Sender: TObject);
> with cnMain do
> begin
> Path := 'c:\h\IBOTables\Family.gdb';
> Server := 'LOCALHOST';
>\\ Protocol := cpTCP_IP; \\ Won't work in my case - unless I remark it out! What am I missing?

'Localhost' is a default TCP/IP local server on all Intel machines, IP address You need to have TCP/IP active on your system to use it and, from the point of view of the client, you will need an entry in your HOSTS file (if it is not already present).

By this means you can connect to you local database as a remote client. This is advisable (in preference to direct local connect) because the client and local ibserver otherwise share Inter-Process Communication space (IPC) in memory. This makes it impossible to use multiple threads in a local ibserver connection.

But it's a matter of design. If you don't intend to create threads, no problem.

> Username := 'SYSDBA';
> Password := 'masterkey'; // NOT RECOMMENDED
> if not Connected then
> Connect;
> { open any datasets you want open at FormCreate}
> end;
>Thanks for that Helen! This works perfectly.
>However is vastly different to the code in Tutorial 1 - which (for your convenience) is as follows

[snipped code]

The tutorial code (not my code, btw) is for creating and running a script to create the tutorial.gdb database which is used throughout the tutorial. Creating and running a CREATE DATABASE script is a server task. You can use that code as a model for creating and running scripts with IBO. It's not meant to be a model for connecting to an existing database.

You will find that several of Jason's self-teach projects begin by testing for the existence of the database used in the project and run similar scripts to create it if necessary.

Use the methods and properties of the connection classes for database connection.

Do use the component help and, in so doing, understand that the entire structure of IBO is hierarchical. If you don't find doc for a particular descendant class, click the Hierarchy button on the top menu and select the next higher ancestor.

For classes that are inherited from VCL classes, go to the Delphi Help.

There is a TI sheet at with some tips for integrating the IBO help in Delphi's help system.


All for Open and Open for All
InterBase Developer Initiative ยท