Switch to standard view
Sybase logo  
Sybase logo  
Products | About Sybase | Support



Contents

What is the Open Client/Server configuration file?

The Open Client/Server configuration file, called ocs.cfg, is a runtime configuration file that contains settable properties governing the behavior of an application or set of applications. The configuration file is a feature new with Open Client and Open Server 11.1.

Where is the Open Client/Server configuration file located?

By default, the configuration file is located in the $SYBASE/config directory. Users can configure a new location using the CS_CONFIG_FILE property, which is set by the cs_config or ct_con_props routine.

For information on how to use the cs_config routine, see the "CS- Library Routines" chapter in the Open Client and Open Server Common Libraries Reference Manual.

For information on how to use the ct_con_props routine, see the "Routines" chapter in the Open Client Client-Library Reference Manual.

What are the advantages of using a configuration file?

All Client-Library applications set various context and/or connection level properties using ct_config and cs_config. Instead of making individual calls for each property, an application can now make use of the configuration file.

Users can both reduce the overhead of making numerous calls to set each of the required properties in each application and change the value of these properties at runtime without having to change and recompile code.

Using the configuration file also simplifies code maintenance.

How do I choose between configuring by application name and configuring by server name?

When configuring properties using the Open Client/Server configuration file, you can configure either by application name or by server name. Your configuration file entry will look different, depending on which method you choose.

Configure by application name when you want to set properties for a particular application that connects to any server.

Configure by server name when you want to set properties for a particular server to which any application connects.

Give me an example that demonstrates configuration by application name.

This example shows the steps to configure by application for an application called "PAYROLL". In this example, we assume that the PAYROLL application needs the following properties set, regardless of which server it connects to:

  1. Create a section in the ocs.cfg file for the PAYROLL application. Within this section, place all properties that need to be set for PAYROLL. Here is what the ocs.cfg entry would look like:
  2. [PAYROLL]
    ; This section defines the properties to be
    ; set for the PAYROLL application. 
    
    CS_OPT_ANSINULL = CS_TRUE
    CS_NOAPI_CHK = CS_TRUE
    CS_TIMEOUT = 60
    
  3. Initialize the application with the chosen name, using the cs_config routine:
  4. cs_config ( context, CS_SET, CS_APPNAME, 
    "PAYROLL", CS_NULLTERM, NULL);
    

    At connect time, ct_connect detects that CS_APPNAME is set to PAYROLL and reads the PAYROLL section of the configuration file for properties information.

Give me an example that demonstrates configuration by server name.

This example shows the steps to configure by server name for a server called "NORTH_AMERICA".

In this example, we assume that all users connecting to NORTH_AMERICA from any Client-Library application must have the following properties set:

  1. Create a section in the ocs.cfg file for the NORTH_AMERICA server. Within this section, place all properties that need to be set for NORTH_AMERICA. Here is what the ocs.cfg entry would look like:
  2. [NORTH_AMERICA]
    
    ; This section defines the properties to be
    ; set for any user connecting to the 
    ; SQL Server named 'NORTH_AMERICA'.
    
    CS_PACKETSIZE = 1024
    CS_LOGIN_TIMEOUT = 30 
    CS_OPT_DATEFORMAT = CS_OPT_FMTDMY
    CS_OPT_TEXTSIZE = 100000
    
  3. Enable configuration by server name¯the default is to configure by application name:
  4. CS_BOOL config_prop = CS_TRUE;
    ...
    
    ct_con_props ( *connection, CS_SET, 
    CS_CONFIG_BY_SERVERNAME,(CS_VOID 
    *)&config_prop, CS_UNUSED, NULL);
    

Can I use the configuration file to establish a default configuration for my application environment?

Yes. Set the properties in the "DEFAULT" section of the configuration file. The section looks like this:

[DEFAULT]
 ....
 ....

Can I use the configuration file with Sybase products other than Client-Library?

Yes. Embedded SQL (C & COBOL) products also make use of the configuration file. Refer to your Embedded SQL documentation for more information.

Where can I find more information on the configuration file feature?

The section called "Using the Run-Time Configuration File" in the 11.x version of the Open Client Client-Library/C Reference Manual discusses the configuration file in detail.



[#]Home  [*]Top

© Copyright 2008, Sybase Inc.