srv_config

Sets server configuration parameters.

Syntax

int srv_config (
SRV_CONFIG *
config,
DBINT
option,
DBCHAR *
value,
int
valuelen );

where

config
Is a pointer to the SRV_CONFIG structure, which contains the values for the configuration options used by the Open Data Services application. Before issuing srv_config, config must first be allocated with srv_config_alloc.
option
Specifies which of the following configuration parameters to set:
SRV_ANSI_CODEPAGE
Specifies how Open Data Services handles character conversion for srv_sendrow and srv_sendmsg. Specify "FALSE" to convert all character data from ANSI to OEM (using the AnsiToOem function) before sending it to the client. Specify "TRUE" to not convert the data before sending it to the client. The default is "TRUE". These conversions do not affect English language characters but can affect extended characters (character positions 128-255) used in many languages.

It is recommended that extended stored procedures do not adjust this option, and always call srv_sendrow and srv_sendmsg with ANSI character strings. Open Data Services will handle any necessary character conversions to be consistent with the character set of SQL Server.

It is recommended that pass-through gateways to SQL Server set SRV_ANSI_CODEPAGE to "TRUE" to avoid any character conversion. DB-Library clients and SQL Server will handle any necessary character conversions.

For standalone Open Data Services applications with data that is already in ANSI form, and when you need to connect clients running MS-DOS, it is recommended that you set SRV_ANSI_CODEPAGE to "FALSE". ODS will convert your ANSI data to OEM before sending it to the client. Clients running MS-DOS will do no conversion, and clients running Windows and Windows NT can turn on AutoANSItoOEM. If your clients are running Windows and Windows NT only (none running MS-DOS), you can set SRV_ANSI_CODEPAGE to "TRUE" in your Open Data Services application, and turn off AutoANSItoOEM on the clients to avoid converting from ANSI to OEM at the server, and then from OEM back to ANSI at the client.

For standalone Open Data Services applications with data that is already in OEM form, it is recommended that you set SRV_ANSI_CODEPAGE to "TRUE" to avoid invalid character conversion. Clients running Windows and Windows NT can turn on AutoANSItoOEM.

For more information about DB-Library character set conversion and the AutoANSItoOEM client option, see Appendix A of the Microsoft SQL Server Programming DB-Library for C.

srv_connections
The maximum number of client connections that the server will accept. This value must be a positive integer; the default is 10.
SRV_DEFAULT_PACKETSIZE
The default TDS packet size used by the Open Data Services application and the client connection if the client did not request a specific TDS packet size.
srv_logfile
The name of the log file to which the server will write Open Data Services messages. The default name is SRV.LOG. Messages are added to the log file when an srv_log function is issued. To stop adding messages and close the open log file, set value to " " and valuelen to 0.
SRV_MAX_PACKETS
The maximum number of tabular data stream (TDS) packets that Open Data Services will read for each incoming client or server request. The default value is 128 packets, allowing for 64K of data per request when using the default TDS packet size of 512 bytes. If clients or servers receive error messages that some requests are too large, increase this value. (This is most likely to occur for remote stored procedure requests that pass a large amount of information.)
srv_max_packetsize
The maximum TDS packet size that Open Data Services will use for all Net-Library connections. This value can be from 512 to 65535; the default is 512. DB-Library clients that request a large TDS packet size via DBSETLPACKET will use either the requested TDS packet size or the value specified by srv_max_packetsize, whichever is smaller. A larger packet size allows the ODS Library to execute large client requests and server responses with fewer network operations.
srv_maxworkingthreads
The maximum number of working threads that can actively process client requests on the server at one time. This value must be a positive integer between 1 and 65535; the default is 255. This parameter limits the size of the active thread pool, not the number of client connections. (To limit client connections, see the SRV_CONNECTIONS option.)
srv_minworkingthreads
The minimum number of worker threads available to process client requests when the application is idle. This value must be a positive integer between 1 and 65535; the default is 32.
SRV_REMOTE_ACCESS
Must be set to "TRUE" to allow SYBASEŽ- and OS/2-based SQL Servers to access the Open Data Services server application; the default is "TRUE". Specify "FALSE" to deny access to these types of servers.
SRV_REMOTE_CONNECTIONS
The maximum number of individual remote stored procedure requests that the Open Data Services server application will accept from SYBASE- and OS/2-based SQL Server sites at one time; the default is 20. Each SYBASE- or OS/2-based SQL Server site that establishes a session with Open Data Services can send multiple remote stored procedure requests. This parameter limits the total number of simultaneous, requests from all sites.
SRV_REMOTE_SITES
The maximum number of active sessions that the Open Data Services server application can establish with individual SYBASE- and OS/2-based SQL Server sites at one time; the default is 10. Each SYBASE- or OS/2-based SQL Server site can establish a single session with Open Data Services. This parameter limits the total number of simultaneous sessions.
srv_stacksize
The stack space size to be allocated for each new connect event. The default is 4096 bytes. For each new client connection, the ODS Library allocates a separate stack, reserving an area for client connection information and for client callback functions. Normally the default stack size is sufficient. However, some developer-defined callback functions might require a larger stack space in order to operate properly. SRV_STACKSIZE allows you to adjust the stack size allocated to each client connection thread.
SRV_THREADPRIORITY
The thread priority (within a priority class) of every Open Data Services thread. It must be one of the following values:

SRV_PRIORITY_LOW: 2 points below normal priority

SRV_PRIORITY_NORMAL: Normal thread priority

SRV_PRIORITY_HIGH: 2 points above normal priority

SRV_PRIORITY_REALTIME: Highest possible priority

The default value is SRV_PRIORITY_NORMAL.

srv_threadtimeout
The number of minutes that worker threads and networking threads can remain idle before they time out and exit. This value must be a positive integer between 1 and 65535; the default is 15. A thread is forced to exit if it remains idle for the specified time-out value. This parameter allows a decrease in network and worker threads during idle processing.
value
Is a character string that provides the value for the configuration option. Specifying 0 sets option to its default value.
valuelen
Indicates the length, in bytes, of the value string. If valuelen is SRV_NULLTERM, then the value string is expected to be null terminated and valuelen is ignored.

Returns

SUCCEED or FAIL.

Remarks

All configuration options have default values. The srv_config function is not required unless configuration option values differ from the default values. The log file can be changed at any time by calling srv_config with the log file option and specifying a new filename for value. Open Data Services sets the valuelen to 0 and uses the string in value.

All thread configuration parameters can be changed at any time by calling SRV_GETCONFIG and then srv_config again, specifying new values, which take effect immediately. Changes to SRV_CONNECTIONS, SRV_MAX_PACKETS, SRV_REMOTE_ACCESS, SRV_REMOTE_CONNECTIONS, and SRV_REMOTE_SITES do not take effect until you re-start the Open Data Services application.

The options SRV_REMOTE_ACCESS, SRV_REMOTE_CONNECTIONS, and SRV_REMOTE_SITES apply only when the Open Data Services server application is servicing incoming requests from SYBASE SQL Server or Microsoft SQL Server for OS/2. Because these servers can make multiple requests in a single session, option parameters are provided to prevent one or more servers from consuming the resources of the Open Data Services server application. With Microsoft SQL Server for Windows NT, individual remote stored procedure requests are handled by Open Data Services as separate client sessions, eliminating the potential for resource contention problems.

Open Data Services uses a pool of working threads to process client requests.

At least one worker thread must be available to process active client requests. If the number of client connections exceeds the maximum number of available worker threads specified with SRV_MAXWORKINGTHREADS, Open Data Services will continue to accept client connections by placing them in a queue until they can be serviced by available threads from the thread pool. Threads are subject to time-outs and will exit if they are idle beyond the specified time-out value, in order to minimize processing overhead when the application is idle.

See Also

This entry For information about
srv_config_alloc Allocating an Open Data Services server configuration structure
srv_event Activating an event
SRV_GETCONFIG Accessing an Open Data Services server configuration structure
srv_init Initializing an Open Data Services server application
srv_log Writing a message to the Open Data Services server log file
srv_run Starting an Open Data Services server application