Hi,
I have a program in C/C++, with embedded SQL, with a single thread of
execution. I am trying to establish two database connections, to the
same database, so I can have concurrent, independant transactions.
(deadlocks, locking etc. is not an issue because different set of
tables are accessed, always).
The code does not call sqleSetTypeCtx.
My first question is: What is the exact purpose of this function? Is it
just to provide synchronization when multiple threads are trying to
access the database?
What the code does is - it acts as normal, one-database,
single-threaded application - issues EXEC SQL CONNECT ... executes some
SQL statements (update/delete/insert/select) ... and at some point it
decides to establish second database connection, if it is not already
established, (this can be in a middle of a transaction in the first
connection).
The code uses the Admininistrative API to create new context, attach to
it, run EXEC SQL CONNECT ... and some SQL statements, and at the end
detaches from the new context.
This setup seems to work Ok when compiled with DB2 8.2 client.
But if it is compiled with DB2 7 client, the second connection attempt
fails with SQL0752N error.
All functions that deal with establishing database connection have
their own sqlca-s and do not share variables.
Any suggestions what the problem could be are appreciated.
Thanks,
D.