srv_config

Sets server configuration parameters.


Important This Open Data Services function or macro is only supported in Microsoft® SQL Server™ version 7.0 for backward compatibility.


For more information about Open Data Services functions or macros supported for backward compatibility, see Open Data Services (Level 3).

Syntax

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

Arguments
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
Is one 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 not adjust this option and always call srv_sendrow and srv_sendmsg with ANSI character strings. Open Data Services handles 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 handle any necessary character conversions.

For stand-alone Open Data Services applications with data already in ANSI form, and when you need to connect clients running Microsoft MS-DOS®, it is recommended that you set SRV_ANSI_CODEPAGE to FALSE. Open Data Services converts ANSI data to OEM before sending it to the client. Clients running MS-DOS do no conversion, and clients running Microsoft Windows® and Microsoft Windows NT® can enable AutoANSItoOEM. If clients are running Windows and Windows NT only (none running MS-DOS), you can set SRV_ANSI_CODEPAGE to TRUE in the Open Data Services application, and disable 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 stand-alone Open Data Services applications with data 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 enable AutoANSItoOEM.

SRV_CONNECTIONS
The maximum number of client connections the server accepts. This value must be a positive integer; the default is 10.
SRV_DEFAULT_PACKETSIZE
The default tabular data stream (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 writes 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 TDS packets that Open Data Services reads for each incoming client or server request. The default value is 128 packets, allowing for 64 KB 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 uses 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 by using DBSETLPACKET 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_PASSTHROUGH
Allows a pass-through gateway to SQL Server 7.0 when set to TRUE. The default is FALSE.
SRV_REMOTE_ACCESS
Allows SYBASE- and OS/2-based SQL Servers to access the Open Data Services server application when set to TRUE. 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 accepts from SYBASE- and OS/2-based SQL Servers at one time; the default is 20. Each SYBASE- or OS/2-based SQL Server 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 the Open Data Services server application can establish with individual SYBASE- and OS/2-based SQL Servers at one time; the default is 10. Each SYBASE- or OS/2-based SQL Server 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 may require a larger stack space to operate properly. SRV_STACKSIZE allows you to adjust the stack size allocated to each client connection thread.
SRV_THREADAFFINITY
Associates threads with available processors. Using this parameter can result in better processor cache use and performance by reducing context switching and thread migration between processors. The default is 0.

The SRV_THREADAFFINITY parameter specifies a value in an affinity mask that is a bit vector in which each bit represents processors that a thread can run on. As threads are created, they are associated with one of the processors in the affinity mask. Administrators can control processor usage by masking various processors ON or OFF for use by Open Data Services.

Initialize SRV_THREADAFFINITY by setting the corresponding bit of the processor(s) to ON. The SRV_THREADAFFINITY processor bit value is a binary value. For example, to use processors 1 through 4, set processor bits 1 through 4 ON by using this setting:

SRV_THREADAFFINITY = 15

To use processors 1 through 6, set processor bits 1 through 6 ON by using this setting:

SRV_THREADAFFINITY = 63

SRV_THREADPRIORITY
The thread priority (within a priority class) of every Open Data Services thread. It must be one of the following values:
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. Specify 0 to set option to the 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 default values. The log file can be changed at any time by calling srv_config with the log-file option and specifying a new file name 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 restart 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 a 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 continues 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 they exit if they are idle beyond the specified time-out value to minimize processing overhead when the application is idle.

See Also
srv_event srv_log
srv_getconfig srv_run
srv_init  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.