Subject Re: [IBO] Threads
Author Robert martin
Hi,

I am explicitly creating a TIB_Sesssion, a TIBODatabase (setting its IB_Session to the previously created TIB_session). All my TIBOTables and TIBOQueries IB_Connection is set to that IBODatabase. This is created in the execute method of the thread.

Code sample.....

procedure TEmailOutputThread.Execute; // Thread
....
fEmailSession := TIB_Session.Create(Application);
fEmailSession.TimerInterval := 0;

IBODataBase := TIBODatabase.Create(fEmailSession);
IBODataBase.IB_Session := fEmailSession;
IBODataBase.DatabaseName := Email.DatabasePathAndName;
IBODataBase.Password := WS_DB_PASSWORD;
IBODataBase.Username := WS_DB_USERNAME;
IBODataBase.Protocol := cpTCP_IP;
IBODataBase.PageSize := WS_DB_PAGESIZE;
IBODataBase.SQLDialect := 3;
IBODataBase.Connected := True;
......


IBOQuery := TIBOQuery.Create(Application);
IBOQuery.Ib_Connection := IBODatabase;
....


Is this a correct structure? From what you are saying Kishore it sounds like I don't need to create a unique TIBOSession?

I am getting a funny exception on connected line the first time this code is run, it says 'ISC ERROR CODE: 335544324 ISC ERROR MESSAGE: invalid database handle (no active connection)'. I suspect this may be being caused by one of the other threads but need to make sure I am doing things right before I go hunting :)

Does any one know where the example thread demos are? The help files seem either out of date or give conflicting information (i.e. call the session doTimer method, which does not exist).

Do I need to do anything with the ProcessPassiveTasks method ?

Thanks for your help :)



Rob Martin
Software Engineer

phone 03 377 0495
fax 03 377 0496
web www.chreos.com
----- Original Message -----
From: KISHORE
To: IBObjects@yahoogroups.com
Sent: Wednesday, July 07, 2004 7:51 PM
Subject: Re: [IBO] Threads


Hi,

I have recently faced some problems using IBO in multi-threaded application and solved them. So, i would like someone to validate the following things:-

1. When you are using IBO components in threads, first thing to make sure is that each thread has its own IB_connection object created and all the datasets and transactions created in the thread use the respective connection.
2. And also that the IB_Connection object has to be created with in the Thread itself. i.e, you cannot have a IB_Connection objects pool (db connection pool) created in your application and share the IB_connection objects between different application thread pools.
3. CacheStatementHandles property of IB_Connection object must be set to False (which is true by default).
4. If you make sure that the IB_Connection object is created with in the thread then IBO automatically creates the IB_Session object by itself and sets the TimerInterval property to 0.



Note: Original message added as attachment.



Best regards
Kishore
Mobile: 08031839084



------------------Original Message-----------

From : "Robert martin" <rob@...>
To : <IBObjects@yahoogroups.com>
Date : 07/07/2004 2:41:31 AM
Subject : [IBO] Threads




Hi

We are new to IBObjects and Firebird. I am porting a large threaded application using the IBO components and have seen mention of some thread demo applications, I cant seem to find these, any pointers??

Specifically I am interested in the TimerInterval property that I read should be set to 0 in a thread, I am then supposed to call the DoTimer method occasionally (??). I can't find a DoTimer method and am not sure of the best place to call it from if I did.


Rob Martin
Software Engineer

phone 03 377 0495
fax 03 377 0496
web www.chreos.com

[Non-text portions of this message have been removed]



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !


Yahoo! Groups Sponsor
ADVERTISEMENT




--------------------------------------------------------------------------------
Yahoo! Groups Links
* To visit your group on the web, go to:
* http://groups.yahoo.com/group/IBObjects/
* To unsubscribe from this group, send an email to:
* IBObjects-unsubscribe@yahoogroups.com
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


[Non-text portions of this message have been removed]



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !


Yahoo! Groups Sponsor
ADVERTISEMENT





------------------------------------------------------------------------------
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/

b.. To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]