Retrieve a data source handle for connections that use a specified set of values for server, user name, password, and connectivity library.
JagStatus JagCmGetCachebyUser ( SQLCHAR *username, SQLCHAR *password, SQLCHAR *server, SQLCHAR *con_lib, JagCmCache *cache );
The user name for connections in the desired data source.
The password used by connections in the desired data source.
For ODBC connections, the ODBC data source name (as you would use to call SQLConnect). For Client-Library connections, the server name (as you would use to call ct_connect).
A string value indicating the connectivity library used by connections in the data source. Allowable values are:
con_lib value |
To indicate |
---|---|
“CTLIB_110” |
Sybase Open Client Client-Library |
“ODBC” |
An ODBC implementation library |
“OCI_7” |
Oracle Call Interface 7.x |
“OCI_8” |
Oracle Call Interface 8.x |
The address of a JagCmCache handle. If a matching data source is available, its handle is returned as *cache. If no matching data source exists, *cache is set to NULL.
Return value |
To indicate |
---|---|
JAG_SUCCEED |
Success. *cache is set to the address of the matching data source. |
JAG_FAIL |
Failure. |
JagCmGetCachebyUser fails for the following reasons:
A NULL value was passed for username, password, server, or con_lib.
An invalid value was passed for con_lib.
No matching data source was found.
JagCmGetCachebyUser allows you to retrieve connections that match the desired characteristic values for:
Server name
User name
Password
Connectivity library
You can use this routine when you are not sure if a data source is configured for a particular set of characteristic values. If no such data source is available, JagCmGetCachebyUser sets the *cache parameter to NULL. If one or more matching data sources exist, JagCmGetCachebyUser sets *cache to the handle for the first matching data source that it finds.
See JagCmGetConnection for an example that calls JagCmGetCachebyUser.