Skip to content

Instantly share code, notes, and snippets.

@rsyring
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsyring/e107d0443f6a0ca69a97 to your computer and use it in GitHub Desktop.
Save rsyring/e107d0443f6a0ca69a97 to your computer and use it in GitHub Desktop.
FreeTDS: choosing a protocol version
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html data-ember-extension="1">
<head>
<title>Choosing a TDS protocol version</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
<link rel="HOME" title="FreeTDS User Guide" href="http://www.freetds.org/userguide/index.htm">
<link rel="UP" title="Install FreeTDS" href="http://www.freetds.org/userguide/install.htm">
<link rel="PREVIOUS" title="Install FreeTDS" href="http://www.freetds.org/userguide/install.htm">
<link rel="NEXT" title="servername Lookup" href="http://www.freetds.org/userguide/name.lookup.htm">
<link rel="STYLESHEET" type="text/css" href="Choosing%20a%20TDS%20protocol%20version_files/userguide.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body class="SECT1" alink="#0000FF" bgcolor="#FFFFFF" link="#0000FF" text="#000000" vlink="#840084">
<div class="NAVHEADER">
<table summary="Header navigation table" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<th colspan="3" align="center"><span class="PRODUCTNAME">FreeTDS</span> User Guide: A Guide to Installing, Configuring, and Running <span class="PRODUCTNAME">FreeTDS</span>
</th>
</tr>
<tr>
<td align="left" valign="bottom" width="10%"><a href="http://www.freetds.org/userguide/install.htm" accesskey="P">Prev</a>
</td>
<td align="center" valign="bottom" width="80%">Chapter 3. Install <span class="PRODUCTNAME">FreeTDS</span>
</td>
<td align="right" valign="bottom" width="10%"><a href="http://www.freetds.org/userguide/name.lookup.htm" accesskey="N">Next</a>
</td>
</tr>
</tbody>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="CHOOSINGTDSPROTOCOL">Choosing a <acronym class="ACRONYM">TDS</acronym> protocol version</a></h1>
<p>The <acronym class="ACRONYM">TDS</acronym> protocol version is probably something you'd rather not know even existed, much less something you'd have to choose. But there's not that much to it, really. Unless you run into an incompatibility, you're best off running with the highest protocol version supported by your server. That's what the vendors' own products do, which is why when you read the Sybase or Microsoft documentation you find no mention of <acronym class="ACRONYM">TDS</acronym> versions.
</p>
<div class="TABLE">
<a name="TAB.PROTOCOL.BY.PRODUCT"></a>
<p><b>Table 3-1. Versions of the <acronym class="ACRONYM">TDS</acronym> Protocol, by Product</b>
</p>
<table class="CALSTABLE" border="1">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>Product</th>
<th>TDS Version</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sybase before System 10, Microsoft SQL Server 6.x</td>
<td>4.2</td>
<td>Still works with all products, subject to its limitations. </td>
</tr>
<tr>
<td>Sybase System 10 and above</td>
<td>5.0</td>
<td>Still the most current protocol used by Sybase. </td>
</tr>
<tr>
<td>Sybase System SQL Anywhere</td>
<td>5.0 <span class="emphasis"><i class="EMPHASIS">only</i></span> </td>
<td>Originally Watcom SQL Server, a completely separate codebase. Our best information is that SQL Anywhere first supported TDS in version 5.5.03 using the OpenServer Gateway (OSG), and native TDS 5.0 support arrived with version 6.0. </td>
</tr>
<tr>
<td>Microsoft SQL Server 7.0</td>
<td>7.0</td>
<td>Includes support for the extended datatypes in <span class="PRODUCTNAME">SQL Server</span> 7.0 (such as char/<code class="STRUCTNAME">varchar</code> fields of more than 255 characters), and support for Unicode.</td>
</tr>
<tr>
<td>Microsoft SQL Server 2000</td>
<td>7.1</td>
<td>Include support for <code class="SYMBOL">bigint</code> (64 bit integers), <code class="SYMBOL">variant</code> and collation on all fields. Collation is not widely used. </td>
</tr>
<tr>
<td>Microsoft SQL Server 2005</td>
<td>7.2</td>
<td>Includes support for varchar(max), varbinary(max), xml datatypes and MARS<a name="AEN898" href="#FTN.AEN898"><span class="footnote">[a]</span></a>.</td>
</tr>
<tr>
<td>Microsoft SQL Server 2008</td>
<td>7.3</td>
<td>Includes support for time, date, datetime2, datetimeoffset.</td>
</tr>
<tr>
<td>N/A</td>
<td>8.0</td>
<td><span class="PRODUCTNAME">FreeTDS</span> will alias this version to 7.1
for backwards compatibility reasons, but this should be avoided due to
future compatibility concerns. See note below on obsolete versions. </td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="3">Notes:
<br><a name="FTN.AEN898">a. </a><span class="emphasis"><i class="EMPHASIS">Multiple Active Result Sets</i></span>.
<br>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>For best results, use the highest version of the protocol supported by your server. If you encounter problems, try a lower version. If that works, though, please report it to the mailing list!
<a name="AEN906" href="#FTN.AEN906"><span class="footnote">[1]</span></a>
</p>
<p></p>
<p></p>
<p><b>TDS 4.2 has limitations</b>
</p>
<ul>
<li>
<p><acronym class="ACRONYM">ASCII</acronym> only, of course.</p>
</li>
<li>
<p><acronym class="ACRONYM">RPC</acronym> is not supported.</p>
</li>
<li>
<p><acronym class="ACRONYM">BCP</acronym> is not supported.</p>
</li>
<li>
<p><code class="STRUCTNAME">varchar</code> fields are limited to 255 characters. If your table defines longer fields, they'll be truncated.</p>
</li>
<li>
<p>dynamic queries (also called <i class="FIRSTTERM">prepared statements</i>) are not supported.</p>
</li>
</ul>
<p></p>
<p> The protocol version may also affect how database servers interpret commands. For example, Microsoft SQL Server 2000 is known to behave differently with versions 4.2 and 7.0. Version 7.0 is recommended for compatibility with SQL Server tools.</p>
<p><b>Regarding obsolete versions</b>
<p>In the earlier days of FreeTDS, Microsoft did not release official specs for the TDS
protocol. When MSSQL 2000 (product 8.0) was released, there was semi-official indications
from the Microsoft community that the TDS protocol would be version 8.0. So the FreeTDS
developers adopted that version for FreeTDS. Years later, when Microsoft started releasing
official specs of the protocol, it became obvious that the TDS versions that FreeTDS had
labeled 8.0 and 9.0 were actually versions 7.1 and 7.2 respectively.</p>
<p>For compatibility reasons version 8.0 is still handled by <span class="PRODUCTNAME">FreeTDS</span>
but you should avoid using it as it could be removed in a future version of FreeTDS or it could clash with a
future SQL server version.</p>
</div>
<h3 class="FOOTNOTES">Notes</h3>
<table class="FOOTNOTES" border="0" width="100%">
<tbody>
<tr>
<td align="LEFT" valign="TOP" width="5%"><a name="FTN.AEN906" href="http://www.freetds.org/userguide/choosingtdsprotocol.htm#AEN906"><span class="footnote">[1]</span></a>
</td>
<td align="LEFT" valign="TOP" width="95%">
<p>Want to help? Try out the auto-protocol feature. <span class="PRODUCTNAME">FreeTDS</span> has experimental support for iteratively trying protocol connections until it finds one the server accepts. This is suitable when query responses are non-trivial (because the tiny delay in connecting is thus insignificant). Try setting your TDS version to <tt class="LITERAL">0</tt> and report your results. </p>
</td>
</tr>
</tbody>
</table>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td align="left" valign="top" width="33%"><a href="http://www.freetds.org/userguide/install.htm" accesskey="P">Prev</a>
</td>
<td align="center" valign="top" width="34%"><a href="http://www.freetds.org/userguide/index.htm" accesskey="H">Home</a>
</td>
<td align="right" valign="top" width="33%"><a href="http://www.freetds.org/userguide/name.lookup.htm" accesskey="N">Next</a>
</td>
</tr>
<tr>
<td align="left" valign="top" width="33%">Install <span class="PRODUCTNAME">FreeTDS</span>
</td>
<td align="center" valign="top" width="34%"><a href="http://www.freetds.org/userguide/install.htm" accesskey="U">Up</a>
</td>
<td align="right" valign="top" width="33%"><tt class="REPLACEABLE"><i>servername</i></tt> Lookup</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment