Informix 4.0 and 4.1 questions (std engine)
Posted in 1993
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Can anyone help with the following questions ?
We are running SCO UNIX version 3.2 with the Informix standard engine
(ESQL/C version 4.01.UD2 and sqlexec version 4.01.UD2) on an
Intel 386.
We have a process that once started, lives forever, periodically
updating a database by INSERTs or UPDATEs. For efficiency reasons,
this process PREPAREs all the SQL statements during its
initialization, and then later EXECUTEs the SQL statements to
update the database.
Occasionally, its sqlexec child process terminates. The parent
process traps the SIGCLD (UNIX) signal and executes a siglongjmp()
(UNIX system call) to recovery code (set up with the sigsetjmp()
UNIX system call). The recovery code includes calling sqlexit()
and sqlstart() to clean up and start up a new sqlexec process.
The database is then opened again. However, when the process
again PREPAREs all the SQL statements, Informix returns the error
code -258 "System error--invalid statement ID received by the
sqlexec process". The process tries periodically to PREPARE the
SQL statements until it's successful, but Informix continues to
return the same error code. Only in a few cases did Informix
successfully PREPARE some (but not all) of the SQL statements
after several attempts by the process.
*** Question: What can we do to solve this problem ?
(Restarting the process is not an option.)
Okay, back to the same process. When it periodically saves data
in the database, this process can be doing hundreds of INSERTs or
UPDATEs. To determine whether to do an INSERT or an UPDATE, the
process first attempts to do an INSERT. Following an INSERT, if
the process detects a negative number in sqlca.sqlcode and the
ISAM error code -100 (in sqlca.sqlerrd[1]), the process does the
following:
- SELECTs the existing entry from the database,
- combines the new data and the selected data, and
- UPDATEs the existing entry in the database with the combined data.
*** Questions: Is this a good strategy to use ?
If not, any suggestions ?
The following problem exists with the above scenario ....
Occasionally, when the process detects the existing entry and then
tries to SELECT it, Informix returns SQLNOTFOUND. When we manually
query the database (using isql) for the existing entry, the so-called
"existing" entry is not in the database !!
*** Question: Why would this happen ?
Any help would be very much appreciated. Thank you.
Pauline Benton (pbenton@vnet.ibm.com)