Bendrinti naudojant


1.3 Overview

The Tabular Data Stream (TDS) protocol versions 7 and 8, hereinafter referred to as "TDS", is an application-level protocol used for the transfer of requests and responses between clients and database server systems. In such systems, the client establishes a long-lived connection with the server. Once the connection is established using a transport-level protocol, TDS messages are used to communicate between the client and the server. A database server can also act as the client if needed, in which case a separate TDS connection has to be established. Note that the TDS session is directly tied to the transport-level session, meaning that a TDS session is established when the transport-level connection is established and the server receives a request to establish a TDS connection. It persists until the transport-level connection is terminated (for example, when a TCP socket is closed). In addition, TDS does not make any assumption about the transport protocol used, but it does assume the transport protocol supports reliable, in-order delivery of the data.

TDS includes facilities for authentication and identification, channel encryption negotiation, issuing of SQL batches, stored procedure calls, returning data, and transaction manager requests. Returned data is self-describing and record-oriented. The data streams describe the names, types, and optional descriptions of the rows being returned.

The difference between the TDS 7.x version family and the TDS 8.0 version centers on where and how network channel encryption is initiated:

  • In the TDS 7.x version family, encryption is optional and is negotiated and handled in the TDS layer.

  • The TDS 8.0 version introduces mandatory encryption that is handled in the lower layer before TDS begins functioning.

The following diagram depicts a (simplified) typical flow of communication in the TDS protocol.

Communication flow in the TDS protocol.

Figure 1: Communication flow in the TDS protocol

The following example is a high-level description of the messages exchanged between the client and the server to execute a simple client request such as the execution of a SQL statement. It is assumed that the client and the server have already established a connection and authentication has succeeded.

 Client:SQL statement

The server executes the SQL statement and then sends back the results to the client. The data columns being returned are first described by the server (represented as column metadata or COLMETADATA (section 2.2.7.4) and then the rows follow. A completion message is sent after all the row data has been transferred.

 Server:COLMETADATAdata stream
 ROWdata stream
 .
 .
 ROWdata stream
 DONEdata stream

For more information about the correlation between data stream and TDS packet, see section 2.2.4.<1>

Additional details about which Microsoft SQL Server version corresponds to which TDS version number are defined in LOGINACK (section 2.2.7.14).