On 3/22/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
Voxen <[EMAIL PROTECTED]> wrote:
>> There's no "like" - you do use connection pointer directly from
>> thread B. The fact that the piece of code thread B currently
>> executes is a method of an object that happened to be created by
>> thread A is immaterial.
>
> That clears things and it shows me I need to open/close the database
> locally when a method is called by several threads.
Well, you can have each thread open a connection, then pass it along as
a parameter to whatever function the thread needs to call. This way, the
method would always operate on a connection associated with whatever
thread were calling it, and you won't have to keep opening and closing
connections all the time.
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------
Just be careful with this, because if you have multiple threads
requesting this shared connection you will have to use some kind of
mutual exclusion technique to allow only one thread to access the
connection at a time.
--
Rich
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------