multithreading & ESQL
Posted in 2000
Topics: SQL Development & Query Writing, Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues, Internationalization & Character Sets
Hi ! We are running into problems on IUS9.14/IUS9.2, Solaris 2.5.1 and ESQL. When using multithreading (THREADLIB=SOL), the SQLSTATE variable does not work, it will always display "00", i.e. no error. Even if sql execution results in errors, the SQLSTATE variable does not show the right code, but "00". We suspect that this behaviour results from the libraries linked to. In fact, if we link to ifsql instead of thsql, the SQLSTATE variable works (however, multithreading will break and result in seg faults :( we trued the followin link line (make variable defs shown): LDFLAGS += -L$(INFORMIXDIR)/lib \\ -L$(INFORMIXDIR)/lib/esql \\ # variant a) as used by esql (STATOPT=1 THREADLIB=SOL esql -thread -lib) IFXLIBS= -lthasf -lthgen -lthos -lifgls \\ -lnsl -lsocket -laio -lm -ldl -lelf \\ /proj/informix/lib/esql/checkapi.o -lifglx \\ -lthread # variant b) IFXLIBS= -lifcss -lifgls -lifglx -lifsql -lthxa \\ -lthgen -lthos -lthasf -lthsql \\ $(INFORMIXDIR)/lib/esql/checkapi.o case a) results in empty SQLSTATE but is the one suggested by esql case b) was found by experimentation; using libifsql renders the SQLSTATE variable useful but is (of course) not thread safe. Furthermore, as you will see from using libthxa, we are using informix XA library in order to use informix as XA resource manager in an X/Open DTP environment. Any help ? By the way, we also wonder if informix XA supports TM_JOIN option in xa_start() ... Your help is very much appreciated. --Chris
Christoph Liebig <chris@paris.dvs1.informatik.tu-darmstadt.de> wrote: > Hi ! > We are running into problems on IUS9.14/IUS9.2, Solaris 2.5.1 and ESQL. > When using multithreading (THREADLIB=SOL), the SQLSTATE variable > does not work, it will always display "00", i.e. no error. Hi ! Thanks for the help. The reason for the above behaviour is that we forgot to define IFX_THREAD when compiling. The preprocessor will then replace the global variable SQLSTATE with a function returning thread-specfic SQLSTATE (just as with errno in UNIX syscalls :) --Chris