The following properties control the use of the Open Client and Open Server runtime configuration file:
CS_EXTERNAL_CONFIG – when this property is CS_TRUE at the context level, ct_init reads default Client-Library context property values from the Open Client and Open Server runtime configuration file.
At the context level, CS_EXTERNAL_CONFIG defaults to CS_TRUE if the default Open Client and Open Server runtime configuration file exists, and to CS_FALSE otherwise. The name of the external configuration file is determined by the CS_CONFIG_FILE property. Applications can override the context-level default by calling cs_config.
At the connection level, allocated connection structures inherit CS_EXTERNAL_CONFIG from the parent context. If CS_EXTERNAL_CONFIG is CS_TRUE at the connection level, ct_connect reads default connection properties, capabilities, server options, and debugging options from the Open Client and Open Server runtime configuration file.
CS_CONFIG_FILE – specifies the name and location of the Open Client and Open Server runtime configuration file. CS_CONFIG_FILE is set at the context level with cs_config or at the connection level with ct_con_props. The default value is NULL, which means that a platform-specific default file will be used:
On UNIX platforms, the default configuration file is $SYBASE/$SYBASE_OCS/config/ocs.cfg.
$SYBASE is the path to the Sybase installation directory, specified in the SYBASE environment variable. $SYBASE_OCS is the Open Client and Open Server subdirectory, specified in the SYBASE_OCS environment variable.
On Windows platforms, the default configuration file is %SYBASE%\%SYBASE_OCS%\ini\ocs.cfg.
%SYBASE% is the path to the Sybase installation directory, specified in the SYBASE environment variable. %SYBASE_OCS% is the Open Client and Open Server subdirectory, specified in the SYBASE_OCS environment variable.
For other platforms, see the Open Client and Open Server Configuration Guide for the name of the default Open Client and Open Server runtime configuration file.
CS_CONFIG_BY_SERVERNAME – controls whether ct_connect uses the value of the connection’s CS_APPNAME property or the server name as the file section name. By default, the value of CS_APPNAME is used. CS_CONFIG_BY_SERVERNAME is set at the connection level with ct_con_props.
For example, if external configuration is enabled for the connection, the application name is “Monthly Report,” and the value of server_name is “FinancialDB,” then:
If CS_CONFIG_BY_SERVERNAME is CS_FALSE, ct_connect looks for a section labeled [Monthly Report].
If CS_CONFIG_BY_SERVERNAME is CS_TRUE, ct_connect looks for a section name labeled [FinancialDB].
CS_SERVERNAME cannot be changed in the external configuration file unless CS_CONFIG_BY_SERVERNAME is set to CS_TRUE.
The server and application names are changed by the configuration section. This allows an administrator to override a server or application name that is hard-coded in the application. For example, if the application is set up to read the section name FinancialDB, the section could contain the following:
[FinancialDB]
CS_APPNAME = "Monthly Financial Report"
CS_SERVERNAME = "Dev_FinancialDB" ; redirect to
; development
; server
SYBOCS_CFG – specifies the configuration file to be used, overriding the default ocs.cfg file located as follows:
In UNIX: $SYBASE/$SYBASE_OCS/config/ocs.cfg
In Windows: %SYBASE%\%SYBASE_OCS%\ini\ocs.cfg
CS_APPNAME – at the context level, specifies from which section of the file to read values. Applications call cs_config to set CS_APPNAME at the context level. If the application does not set CS_APPNAME for the context structure, ct_init looks for a section labeled [DEFAULT]. At the connection level, ct_connect reads the file section indicated by CS_APPNAME when external configuration is enabled and the CS_CONFIG_BY_SERVERNAME property has its default value of CS_FALSE.