Subject Re: [IBO] Error SQL -502
Author Helen Borrie
At 09:24 AM 27/05/2005 +0000, you wrote:
>hi all,
>sorry for my english :(
>i've a probleme with multithread application
>i create 1 to 8 thread, each thread create dynamicaly a connection, a
>transaction and some querys.
>if in my application, i create 1 thread it's OK.
>if i create more than 1, i've this error :
>ISC ERROR CODE:335544569
>Dynamic SQL Error
>SQL error code = -502
>Attempt to reopen an open cursor
>in other forum, someone say it's because Query build a cursor for
>reference by server, and for build the cursor a random is use (
>Queryname + RandomString(8), but the query is dynamic so they don't
>have a name at create and more than 1 query have the same cursorname.

An interesting conjecture. :-)

>so i've add Randomize; before creating query, but that don't work :(


You must isolate each thread within its own TIB_Session (also distinct from
the IB_Session that IBO creates for the main thread). You'll find the
TIB_Session component on the iboCore palette.

It's simple, as long as you are careful to have the TIB_Session as the
*first* object created in the thread (fix up the Creation Order if need
be.) Then, set the IB_Session property of your connection object to this
session object...and so on.