Subject RE: [IBO] Unexplained behavior from DefaultSession
Author Bill Morrison
Sorry to be tardy in my response, I missed everyone's response to this
problem for some reason.

The datamodule is created in the context of the thread, and has nothing to
do with the main application. This datamodule is only accessed by the
thread. While there are two TIB_Connections in the datamodule, they each
have their discrete transaction components and queries, they don't share
anything. I have triple checked that they are each pointing to only their
connection/transaction.

I have as yet attempted to dynamically create the tib_connections etc. with
createforsession, although at one point I did explicitly create sessions and
assign them to those sessions (MyConnection.TIB_Session:=somesession;),
which didn't help much.


One interesting note is that this may be related to another problem I have
been discussing with Jason about the TIB_Connection having problems if a RAS
disconnect occurs during data transmission. It may be possible that it's
*that* default session from the previous thread that is firing the error.
This is just a theory however.

So far my "solution" has been to set the checkforoat parameter to 0, which I
believe turns off the timer for OAT. Given that the lifespan for the
connect->work->disconnect is about 3 minutes, and everything is in a
starttransaction .. commit; routine, it should be safe.

Thanks for your responses Geoff and Svein.



Bill

-----Original Message-----
From: Geoff Worboys [mailto:geoff@...]
Sent: Monday, August 06, 2001 2:31 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Unexplained behavior from DefaultSession


> Since no-one seems to have answered you, I guess I can try
> (though the main benefit from me answering will probably be
> to remind Geoff and Jason about your problem).

Whoops, I thought I had, but can see now that I didnt;


Bill,

The main thing I was wondering was whether you were setting up the
components on the separate thread via a datamodule (as in the Threads
sample application) or whether you were creating the various thread
components (TIB_Session, TIB_Component etc) in code?

And in either instance the interesting question then becomes; At what
point are you creating the components? You need to be careful about
whether the components are created in the context of the main thread
or the separate thread - since the "default" session will be
different.

When creating components for separate threads in code I tend to always
use the CreateForSession constructor so that the I can be certain that
the dataset or whatever is certain to be using the specific session
that I want it to. eg.

Transact := TIB_Transaction.CreateForSession(Self, MySession);


Maybe this helps?

Geoff Worboys
Telesis Computing





Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/