dbsetlpacket

Sets the tabular data stream (TDS) packet size in an application’s LOGINREC structure.

Syntax

RETCODE DBSETLPACKET (
PLOGINREC
loginrec,
USHORT
packet_size );

Arguments
loginrec
Is a pointer to the LOGINREC structure to be passed as an argument to dbopen.
packet_size
Is the size requested, in bytes (0 through 65535). The server will set the actual packet size to a value less than or equal to the requested size.
Returns

SUCCEED or FAIL.

Remarks

Tabular data stream (TDS) is an application protocol used for the transfer of requests and request results between clients and servers. TDS data is sent in fixed-size chunks, called “packets.” TDS packets have a default size set by Microsoft® SQL Server™. If an application does bulk copy operations, or sends or receives large amounts of text or image data, a packet size larger than the default might improve efficiency, because it results in fewer network reads and writes. For large data transfers, a packet size between 4092 and 8192 is usually best. Any larger size can degrade performance.

The only way an application can change the TDS packet size is by using DBSETLPACKET. If DBSETLPACKET is not called, all DBPROCESS connections in an application will use the default size.

Note that when the application logs in to the server, the server sets the TDS packet size for that DBPROCESS connection to be equal to or less than the value of the packet_size parameter. If the server is experiencing space constraints, the packet size is set to a value less than the value of the packet_size parameter. Otherwise, the packet size is equal to the value of this parameter. To determine the packet size that the server has set, call dbgetpacket.

Different DBPROCESS connections in an application can use different packet sizes. To set different packet sizes for DBPROCESS connections, an application can either change the packet size in a single LOGINREC structure between the dbopen calls that create the DBPROCESS connections, or it can set different packet sizes in multiple LOGINREC structures and use these different LOGINREC structures when creating the DBPROCESS connections.

See Also
dbgetpacket dbopen
dblogin  

  


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