Subject Re: [IBO] Sessions
Author Helen Borrie
At 04:37 PM 29/01/2003 +0000, you wrote:
>I don't understand them!

Think of a session as an umbrella under which all of the activity of one
instance of your application resides...


>I'm trying to write programs using Intraweb and IBO which runs as an
>Apache DSO on NT4. The first program I wrote would always crash after
>the first time it was run and on reading the help file very carefully
>I discovered that this was probably due to the lack of a session
>component. Hey presto, add a session component and it worked! It's
>very easy to find the answer in help file if you know where to look
>and what question to ask!! This particular application attached
>through a single TIBODatabase to which I attached the session
>component via the default connection.

Here, each instance of your DSO needs its own session so, to do that, you
drop one TIB_Session onto your form or datamodule and make it first in the
creation order. This ensures that each instance of the module that is
created by the DSO has its own ib_session.

The session commands one or more connections and each connection commands
one or more transactions. A connection can command multiple
transactions; and a transaction can be across more than one connection.

>The second program I have to write connects to 3 different .gdb's via
>3 TIBODatabase components.

Three connections, correct.

>Do I need a session component for eahc of them?

No, they are all commanded by one session. AFAIK, there is no way to have
multiple session components inside one application instance. If there is,
I don't know how they would be managed...

>If only one is needed, do I need to connect the session
>components default component to any of them?

If you are not running this as a DSO, ISAPI or other multi-instance
library, then you can just let the application use the default
session. You access the properties of the default session using a
TIB_SessionProps component. (You can use one from the palette instead, if
you prefer, in which case you don't need an ib_sessionprops.)

Use an explicit ib_session if this is going to be a multi-instance module.

There is nothing to "set". IBO knows to use an explicit session if there
is already one created. When using an explicit session, it's essential to
ensure that it gets created before any other components.

>Alternatively, do I have to set the SessionName on the TIBODatabase
>components to the TIB_Session component's name?

Ignore the SessionName property - it refers to the VCL's TSession, not to
the ib_session. It is present in the TIBODatabase for compatibility.

To access the ib_session of any IBO component, refer to its ib_session
property.

Helen