Table of Contents
FreeTDS™ is re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server. It allows many open source applications such as Perl™ and PHP™ (or your own C or C++ program) to connect to Sybase or Microsoft SQL Server™.
FreeTDS™ provides drop-in replacements for
Sybase's DB-Library
and CT-Library
Microsoft's DB-Library
(which differs in small details from Sybase's)
the ODBC
drivers from both vendors
interactive SQL and BCP utilities
The “TDS” part of the name comes from name of the protocol used to communicate with such servers: the Tabular Data Stream.
FreeTDS™ is distributed in source code form, and is expected to compile on just about any operating system. That means every form of Unix® and Unix-like™ system (including notable variants such as Interix® and QNX®), as well as Win32®, VMS®, and OS X®. If it doesn't compile on your system — and you're not using MS-DOS® — it's probably considered a bug.
TDS is a protocol, a set of rules describing how to transmit data between two computers. Like any protocol, it defines the types of messages that can be sent, and the order in which they may be sent. Protocols describe the “bits on the wire”, how data flow.
In reading this manual, it may be helpful to keep in mind that a protocol is not an API, although the two are related. The server recognizes and speaks a protocol; anything that can send it the correct combination of bytes in the right order can communicate with it. But programmers aren't generally in the business of sending bytes; that's the job of a library. Over the years, there have been a few libraries — each with its own API — that do the work of moving SQL through a TDS pipe. ODBC
, DB-Library
, and CT-Library
have very different APIs, but they're all one to the server, because on the wire they speak TDS.
The TDS protocol was designed and developed by Sybase Inc. for their Sybase SQL Server™ relational database engine in 1984. The problem Sybase faced then still exists: There was no commonly accepted application-level protocol to transfer data between a database server and its client. To encourage the use of their product, Sybase came up with DB-Library
.
DB-Library
provided an API to the client program, and communicated with the server. What it sent to the server took the form of a stream of bytes meant for tables of data, a Tabular Data Stream.
In 1990 Sybase entered into a technology sharing agreement with Microsoft which resulted in Microsoft marketing its own SQL Server™. Microsoft kept the DB-Library
API and added ODBC
. (Microsoft has since added other APIs, too. It no longer supports its own DB-Library
implementation.) At about the same time, Sybase introduced a more powerful “successor” to DB-Library
, called CT-Library
, and called the pair OpenClient™.
CT-Library
, DB-Library
, and ODBC
are APIs that — however different their programming style may be — all communicate with the server in the same way. The language they use is TDS.
The TDS protocol comes in several flavors, most of which were not openly documented. If anything, it was considered to be something like a trade secret, or at least proprietary technology. The exception is TDS 5.0, used exclusively by Sybase, for which documentation is available from Sybase.