The connection’s server name, user name, and password are fixed when the cache is established. However, other connection properties can be changed dynamically when the connection is opened. For example:
Server-side connection options – database options, Client-Library ct_options calls, or equivalent ODBC JDBC calls all affect the server’s response to commands sent on the connection.
Database context – different users of a cached connection may use different databases. You can avoid problems by explicitly changing the database each time a cached connection is used.
Connection properties – connection properties affect client-side connection behavior.
Follow these guidelines to avoid problems with inconsistent connection state:
Set any options and properties that your code requires when you obtain a connection.
If your code may share a cache with other components, set changed properties and options back to the original values before releasing the connection. Or change your application configuration so that components that require different database and connection properties use different connection caches.
If your code is the only user of a cache, and no other components use the named cache, then you do not need to set options and properties back to the original values; however, you will have to reset the properties to the original values when you get the connection again.
Copyright © 2005. Sybase Inc. All rights reserved. |