External configuration sample program

The exconfig.c sample program demonstrates how Client-Library application properties can be configured externally.

This example requires that you edit the default runtime configuration file, ocs.cfg, located in %SYBASE%\%SYBASE_OCS%\ini directory. You can also use SYBOCS_CFG environment variable to point to the ocs.cfg file.

The example sets the CS_CONFIG_BY_SERVERNAME Client-Library property, and calls ct_connect with a server_name parameter set to “server1.” In response, Client-Library looks for a [server1] section in the external configuration file. To run the example, edit ocs.cfg file (if necessary), and add the following section:

[server1]
CS_SERVERNAME = real_server_name

where real_server_name is the name of the server that you want to connect to.

For more information on how Client-Library uses external configuration files, see the topics page “Using the Runtime Configuration File” in the Open Client Client-Library/C Reference Manual.