|FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS|
|Prev||Chapter 1. What is FreeTDS?||Next|
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.
For Microsoft servers, FreeTDS now offers the best DB-Library for any OS on the planet (including Windows!) thanks not only to the hard work of its contributors, but also to Microsoft's strategy. It is the only Win64 implementation of DB-Library, and the only Win32 implementation to support modern versions of the protocol. (SQL Server 2008 still accepts the TDS 4.2 connections that Microsoft's old library uses, but rejects BCP uploads with a spurious permission-denied message.)
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. The mailing list has some 700 or so subscribers at this writing. 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, judging by the mailing list, by many webservers running Apache and PHP. Sybase recommends FreeTDS for their EAServer product. Microsoft recommends 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.
Should FreeTDS not suit your needs, some alternatives
If Java is your game, we refer you to the jTDS project on SourceForge. It is a fork of the FreeTDS/JDBC project, by Craig Spannring, and is a free, native 100% Java implementation of a Type 4 JDBC driver.
In the time since FreeTDS was started, Sybase (as well as most major DBMS vendors) has released its database for the Intel GNU/Linux platform. The good: it is a solid product and supports TDS 4.2 and TDS 5.0. The bad: it doesn't support TDS 7.0 or Linux/*BSD on non-Intel platforms. The ugly: Microsoft broke date handling for big endian Sybase clients.
Depending on platform, it may cost something.
They use the ODBC driver on the NT box where your SQL Server runs so you'll never have trouble with new protocols and the like. On the downside, they can be costly and may be inefficient. We know of EasySoft ODBC-ODBC Bridge from EasySoft, Universal Data Access Driver from OpenLink Software, SequeLink from Merant, and ODBC Router from August Software Corporation.
Based on libtds, this is a native ODBC driver for i386 *nix. It is free in price, but comes only as a binary at the present time.
We have no direct experience with this Perl-only option. It has the same caveats as an ODBC bridge except it's free.
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.