
Local Host variables for multi-threaded embedded sql
Regarding the{*filter*} bind: You are likely waiting on a catalog lock.
While an program is running we keep a lock on its package. During a
bind, we need to insert/update rows in the catalog. If the bind needs
to lock the same catalog rows as a running application, the bind will
hang until the running application releases its locks. To release the
package lock, the application must disconnect from the database.
In the example you quoted, the declaration of host_var_3 is thread
safe, but the function are not. In addition to any host variables,
you also need an SQLCA for each statement. Since no SQLCA was defined
in the functions, they would be sharing the global SQLCA created by
the "EXEC SQL INCLUDE SQLCA;" statement (which doesn't appear in the
example). To make the functions thread safe, you'd also need to add
the declaration "struct sqlca sqlca;" to both functions.
Hope this helps.
___________________________________________________________________________
Doug Doole
DB2 Universal Database Development
IBM Toronto Labs