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 – ct_options calls, ‘set’ language commands, or equivalent ODBC 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 connections, set changed properties and options back to the original values before releasing the connection.
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 © 2003. Sybase Inc. All rights reserved. |
![]() |