Code page and country or region code considerations for multi-threaded UNIX applications

Code page and country or region codes are specific to C and C++ embedded SQL applications. On AIX® the functions that are used for runtime querying of the code page and country or region code that you use for a database connection are now thread safe.

However, these functions can create some lock contention (and resulting performance degradation) in a multi-threaded application that uses a large number of concurrent database connections.

You can use the DB2_FORCE_NLS_CACHE environment variable to eliminate the chance of lock contention in multi-threaded applications. When DB2_FORCE_NLS_CACHE is set to TRUE, the code page and country or region code information is saved the first time a thread accesses it. From that point on, the cached information will be used for any other thread that requests this information. By saving this information, lock contention is eliminated, and in certain situations a performance benefit will be realized.

You should not set DB2_FORCE_NLS_CACHE to TRUE if the application changes locale settings between connections. If this situation occurs, the original locale information will be returned even after the locale settings have been changed. In general, multi-threaded applications will not change locale settings, which, ensures that the application remains thread safe.