Subject RE: RE: [IBO] IBO and threads
Author

 I would prefer the code solution, but how do I create a second instance of TIB_session, TIB_Cursor, TIB_connection? Could some one provide me with an example please!



--- In IBObjects@yahoogroups.com, <ibobjects@yahoogroups.com> wrote:

I recommend making a data module to hold everything that goes together.
Put a TIB_Session and however many TIB_Connection, TIB_Query, etc. components you need on that module.
Then, whe you have a need for it to be used, create a TThread and an instance of that DataModule and marry the two together.
 
You can also just do it in code without a data module. I normally start by creating a TIB_Session instance and then thereafter I use that instance as the Owner when I create the subsequent connections, queries, etc. Then, I have the thread do whatever is needed within that TIB_Session context.
 
The rule of thumb is as long as you only have a thread active within a single TIB_Session's full context you are thread safe.
 
Jason


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of soerensoerensen@...
Sent: Tuesday, September 10, 2013 11:47 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] IBO and threads

I'm developing a threaded server and use IBO and Delphi XE4. But how do I create a IBconnection, IBcursor and IBsession for each thread? I tried putting the creation under threadvar. I can compile but gets a runtime error (read access error)