FreeTDS consists of some C libraries.
The FreeTDS libraries support three separate APIs: DB-Library
, CT-Library
, and ODBC
.
Underlying these three is libtds, which handles the low-level details of the TDS protocol,
such as sending, receiving, and datatype conversion.
This document and the FreeTDS website are dedicated to these libraries.
The libraries are portable, mature, and stable. They're expected to compile readily and normally do not crash or corrupt data. Extensive logging aids in diagnosing problems. While they do not include every feature provided by the vendors' libraries, they do faithfully implement a useful — and widely used — subset of their APIs.
The DB-Library
and CT-Library
APIs have been usable for several years. They have been successfully substituted for Sybase's own libraries in a variety of venues, including Perl and PHP.
The ODBC
driver should be fully ODBC 3.5 compliant.
Basic API coverage information for all libraries may be found in this manual. It is maintained in doc/api_status.txt
, included in the source distribution.
![]() | Note |
---|---|
For Microsoft servers, FreeTDS now offers the best |
In addition to the core DB-Library
API, FreeTDS includes a full implementation of DB-Library
's bcp functions, as well as freebcp, a replacement for Sybase's bcp utility.
How big is it? FreeTDS has over 100,000 lines of C code, maintained by a handful of developers. Patches arrive irregularly, varying in size from one-liners to thousand-line monsters. Almost all are applied or used in some way. Safe to say, FreeTDS's success so far lies somewhere between the Beetle and the Edsel.
Who uses it? Oh, pretty much everyone. FreeTDS users number in the tens of thousands. It's used by large corporations, by the U.S. federal government (e.g. Database Access Library at the National Center for Biotechnology Information) and by many webservers running Apache and PHP. Sybase recommends FreeTDS for their EAServer product. Microsoft recommended FreeTDS to their customers who want access to Microsoft SQL Server from non-Win32 clients. So do we.
You may be wondering how these libraries fit with Perl, PHP, TCL, Python, or other popular scripting languages. Most of these languages have bindings to Sybase that use either the DB-Library
or CT-Library
API, for which FreeTDS is intended as a drop-in replacement. For instance, Michael Peppler's DBD::Sybase
works very well using FreeTDS to access Sybase or Microsoft SQL Servers. PHP has options for sybase
(DB-Library
) and sybase-ct
(CT-Library
) APIs.
[3] Microsoft ceased enhancing DB-Library
in 2001, advising customers to “avoid using DB-Library
”. For Microsoft's unmaintained product, that's good advice. But if the DB-Library
specification meets your needs, FreeTDS permits you to keep using it with little loss (and some gain) of functionality.