Contents Index SQLCA management for multi-threaded or reentrant code Connection management with multiple SQLCAs pdf/preface.pdf

UltraLite User's Guide
  The Embedded SQL Interface
    The SQL Communication Area

Using multiple SQLCAs


To manage multiple SQLCAs in your application

  1. Each SQLCA used in your program must be initialized with a call to db_init and cleaned up at the end with a call to db_fini.

    For more information, see db_init function.

  2. The embedded SQL statement SET SQLCA is used to tell the SQL preprocessor to use a different SQLCA for database requests. Usually, a statement such as the following:

    EXEC SQL SET SQLCA 'task_data->sqlca';

    is used at the top of your program or in a header file to set the SQLCA reference to point at task specific data. This statement does not generate any code and thus has no performance impact. It changes the state within the preprocessor so that any reference to the SQLCA will use the given string.

    For information about creating SQLCAs, see SET SQLCA statement [ESQL].


Connection management with multiple SQLCAs

Contents Index SQLCA management for multi-threaded or reentrant code Connection management with multiple SQLCAs pdf/preface.pdf