Contents Index SQLCA fields Using multiple SQLCAs

ASA Programming Guide
  Embedded SQL Programming
    The SQL Communication Area (SQLCA)

SQLCA management for multi-threaded or reentrant code


You can use embedded SQL statements in multi-threaded or reentrant code. However, if you use a single connection, you are restricted to one active request per connection. In a multi-threaded application, you should not use the same connection to the database on each thread unless you use a semaphore to control access.

There are no restrictions on using separate connections on each thread that wishes to use the database. The SQLCA is used by the runtime library to distinguish between the different thread contexts. Thus, each thread wishing to use the database must have its own SQLCA.

Any given database connection is accessible only from one SQLCA, with the exception of the cancel instruction, which must be issued from a separate thread.

For information on canceling requests, see Implementing request management.


Contents Index SQLCA fields Using multiple SQLCAs