Place a connection back in the cache for reuse.
JagStatus JagCmReleaseConnection (
JagCmCache *cache,
SQLCHAR *username,
SQLCHAR *password,
SQLCHAR *server,
SQLCHAR *con_lib,
SQLPOINTER connection,
SQLINTEGER opt
);
The address of a JagCmCache cache handle variable. *cache can be NULL or a valid cache handle.
If *cache is not NULL, must be the cache handle that was used to obtain the connection by calling JagCmGetConnection.
If *cache is NULL, JagCmReleaseConnection attempts to place the connection in a cache that has available space and that uses the same values for username, password, server, and con_lib. If no such cache has available space, the connection is closed and deallocated.
The user name of the connection. Ignored unless cache is NULL.
The password used by the connection. Ignored unless cache is NULL.
The name of the server to which the connection is made. Ignored unless cache is NULL.
A string value indicating the connectivity library used by the connection. Ignored unless cache is NULL. Allowable values for con_lib are:
con_lib value |
To indicate |
---|---|
“CTLIB_110” |
Sybase Open Client Client-Library |
“ODBC” |
An ODBC driver library |
“OCI_7” |
Oracle Call Interface 7.x |
“OCI_8” |
Oracle Call Interface 8.x |
The connection handle to be released. The connection must be in a state that allows commands to be sent to the remote server. If commands were sent using the connection, the results of the commands must have been completely processed.
One of the following symbolic constants:
opt value |
To indicate |
---|---|
JAG_CM_DROP |
The connection should be forced closed and deallocated. If the connection came from a cache, a new connection will be created in its place. |
JAG_CM_UNUSED |
Normal behavior: a connection taken from a cache is placed back in the cache; a connection created outside of a cache is closed and destroyed. |
Use JAG_CM_DROP to destroy a connection when errors have made it unusable.
Returns |
To indicate |
---|---|
ODBC or Client-Library return status |
The result of connectivity library calls to close and deallocate a connection that was not released to a cache. |
CS_SUCCEED |
A Client-Library connection was returned to a cache. |
SQL_SUCCESS |
An ODBC connection was returned to a cache. |
JAG_FAIL |
Failure. JagCmReleaseConnection fails when cache is NULL and con_lib specifies an invalid value. |
JagCmReleaseConnection releases control of a connection that was obtained from JagCmGetConnection.
WARNING! Do not release a connection more than once.
Chapter 26, “Using Connection Management,” in the EAServer Programmer’s Guide for examples.
Copyright © 2005. Sybase Inc. All rights reserved. |