The connection’s server name, user name, and password are fixed when a cache is established. However, you can change other connection properties dynamically when the connection is opened.
Follow these guidelines to avoid problems with inconsistent connection state:
Connection properties – connection properties affect client-side connection behavior.
Server-side connections options – use the Client-Library ct_options routine to set language commands or equivalent ODBC calls. All options affect the server’s response to commands sent on the connection. See Chapter 3, “Routines” in the Open Client Client-Library/C Reference Manual for more information.
Database contexts – different applications from the same user may use different databases. To avoid problems, explicitly specify the database within an applications when caching is turned on.
Set options and properties that your code requires when the client application obtains a connection.
If an application shares cached connections with other applications, set properties and options that have been changed back to the original values before releasing the connection.
If an application is the only connection allowed for a cached pool, and no other components use the same pool, you do not need to set options and properties back to the original values. However, you should still set the database context every time the client application reconnects, even if the application is using cached connections.