has anybody used client sdk 2.20 in a multithreaded program
Posted in 1999
Topics: General Discussion
We have an application which makes multiple connections to Informix each from a seperate thread. Each thread simultaneously accesses the database and executes various sql stmts. It either fails with a core dump, or we receive the following error: ErrorCode = -243 ErrorMsg = Could not position within table SQLSTATE = HY000 We link our application with the -lthcli library. What is the meaning of this error? Are the Informix client libraries really thread-safe? Is there a work around for this? (other than not making simultaneous accesses) Has anybody successfully used client sdk 2.20 in a multithreaded program. Client SDK 2.10 is worse. Using 2.10, you cannot make a conenction from a thread. In 2.20 they fixed this, you can make connections from within a thread. Erol
Erol Guven wrote: > > We have an application which makes multiple connections to Informix > each from a seperate thread. Each thread simultaneously accesses the > database and executes various sql stmts. > > It either fails with a core dump, or we receive the following error: > ErrorCode = -243 > ErrorMsg = Could not position within table > SQLSTATE = HY000 > > We link our application with the -lthcli library. > > What is the meaning of this error? > Are the Informix client libraries really thread-safe? The libraries are thread safe. SQLCODE -243, cannot position within a table, is usually a lock conflict error. You have to check the ISAM error to be sure but I suspect ISAM=-107, -113, -134, -143, -144, or -154 which are all lock related. If there are no other applications modifying or otherwise locking the table and/or it's rows/pages the table may have been created with LOCK MODE PAGE in which case the two threads may be locking each other out and you need to be careful to prevent deadlocks and SET LOCK MODE TO WAIT nsecs in each connection session to prevent instantaneous locks from causing an error in the other thread(s). BTW if you have only one CPU VP it is possible that the thread holding the lock was suspended to allow the thread locked out to run so you will need longer WAIT times to allow for the situation to clear up than you might with multiple CPU VPs. Art S. Kagel