JezK
Edit File: troubleshooting.html
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Troubleshooting</title><link rel="stylesheet" type="text/css" href="userguide.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="home" href="index.html" title="FreeTDS User Guide" /><link rel="up" href="index.html" title="FreeTDS User Guide" /><link rel="prev" href="uodbc.html" title="ODBC on Unix" /><link rel="next" href="serverthere.html" title="Is the server there?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Troubleshooting</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="uodbc.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="serverthere.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="troubleshooting"></a>Chapter 8. Troubleshooting</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="troubleshooting.html#knownissues">Known Issues</a></span></dt><dd><dl><dt><span class="sect2"><a href="troubleshooting.html#known.porting">Porting Issues</a></span></dt><dt><span class="sect2"><a href="troubleshooting.html#Textfields"><span class="type">Text</span> Fields</a></span></dt><dt><span class="sect2"><a href="troubleshooting.html#Endianism">Endianism</a></span></dt><dt><span class="sect2"><a href="troubleshooting.html#Datetime"><span class="type">Datetime</span> and <span class="type">Money</span></a></span></dt><dt><span class="sect2"><a href="troubleshooting.html#IntegratedSecurity">Microsoft's <span class="quote">“<span class="quote">Integrated Security</span>”</span></a></span></dt></dl></dd><dt><span class="sect1"><a href="serverthere.html">Is the server there?</a></span></dt><dd><dl><dt><span class="sect2"><a href="serverthere.html#serverthere.ping">Start with <span class="command"><strong>ping</strong></span></a></span></dt><dt><span class="sect2"><a href="serverthere.html#serverthere.telnet">Test with <span class="command"><strong>telnet</strong></span></a></span></dt><dt><span class="sect2"><a href="serverthere.html#serverthere.tsql">Test with <span class="command"><strong>tsql</strong></span></a></span></dt></dl></dd><dt><span class="sect1"><a href="logging.html">Logging</a></span></dt><dd><dl><dt><span class="sect2"><a href="logging.html#Environment">Environment Variables that Control Logging</a></span></dt><dt><span class="sect2"><a href="logging.html#Logging.freetds.conf"><code class="filename">freetds.conf</code> variables that Control Logging</a></span></dt><dt><span class="sect2"><a href="logging.html#Logging.odbc">Logging in ODBC land</a></span></dt></dl></dd><dt><span class="sect1"><a href="pagenodata.html">"Page contains no data"</a></span></dt><dt><span class="sect1"><a href="seemtooslow.html">Slow connection or data retrieval</a></span></dt></dl></div><div class="epigraph"><p>He's like motherf**king McGuiver, no he's better than McGuiver!</p><div class="attribution"><span>—<span class="attribution">Jason Mewes (Mall Rats)</span></span></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="knownissues"></a>Known Issues</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="known.porting"></a>Porting Issues</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="known.dates"></a>Date Structures and Offsets</h4></div></div></div><p>Microsoft and Sybase use different <code class="systemitem">DB-Library</code> date structures <span class="emphasis"><em>and conventions</em></span>. Notably months can be in the range [0,11] or [1,12]. Pay careful attention to the results of <code class="function">dbdatecrack()</code>. </p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="known.float"></a>Floating Point</h4></div></div></div><p>Precision may surprise you if you pay attention. Microsoft's <code class="systemitem">DB-Library</code> promotes single-precision to double in <code class="function">dbbind()</code> by appending zeros; C promotes it to the nearest double. <span class="productname">FreeTDS</span> relies on the C compiler. </p><p>Math libraries vary, too. If porting an application whose output uses functions such at <code class="function">log(3)</code>, expect differences in different implementations. Perfectly consistent results between OSes will require the use of a single math library. </p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Textfields"></a><span class="type">Text</span> Fields</h3></div></div></div><p>Questions sometimes arise over large <span class="type">varchar</span> types (anything larger than <span class="type">varchar(255)</span>) that became available with Microsoft <span class="productname">SQL Server 7.0</span>. When accessing long <span class="type">varchar</span>s with <acronym class="acronym">TDS</acronym> protocol version 4.2 or 5.0, these fields will be truncated to 255 characters, due to limitations inherent in the protocol definition. Your best bet in that case is to convert them to <span class="type">text</span> types.</p><p>In Microsoft <span class="productname">SQL Server</span> 7.0 and later, <span class="structname">varchar</span> types can hold up to 8000 bytes (8000 <acronym class="acronym">ASCII</acronym> characters or 4000 Unicode characters). To move these large <span class="structname">varchar</span>s through <acronym class="acronym">TDS</acronym> 4.2, convert them with either a <span class="command"><strong>CONVERT</strong></span> as in, </p><pre class="screen"> <strong class="userinput"><code>SELECT mycol = convert(mycol, text) FROM mytable</code></strong> </pre><p> or with the newer SQL92 <span class="command"><strong>CAST</strong></span> syntax e.g., </p><pre class="screen"> <strong class="userinput"><code>SELECT CAST(mycol as TEXT) FROM mytable</code></strong></pre><p>There is also a bug (<span class="quote">“<span class="quote">Lions and tigers and bugs! Oh, my!</span>”</span>) in Microsoft's implementation of <span class="type">text</span> fields. Disregardless [sic] of their documentation, you must explicitly set the value of <code class="envar">TEXTSIZE</code>, else the text fields will be represented to have a maximum size of 4 gigabytes or so. If you encounter some spurious <span class="quote">“<span class="quote">out of memory</span>”</span> error try to set <code class="envar">TEXTSIZE</code> to some reasonable value before querying any <span class="type">TEXT</span> fields. For example, in <span class="application">isql</span>: </p><pre class="screen"> <code class="prompt">1> </code><strong class="userinput"><code>set <code class="envar">TEXTSIZE</code> 10000</code></strong> <code class="prompt">2> </code><strong class="userinput"><code>go</code></strong></pre><p> Another way to handle control the default <code class="envar">TEXTSIZE</code> is to use the setting in <a class="link" href="freetdsconf.html#freetdsconfformat" title="What it looks like"><code class="filename">freetds.conf</code></a>. As most of the time data contained in BLOBs fields are much smaller than larger supported fields, we try to avoid considering field sizes for BLOBs allocating memory as needed instead, so you should not have to reduce this value unless you really want the server to limit data returned by queries.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Endianism"></a>Endianism</h3></div></div></div><p>If either your server or your client is a big endian system, pay careful attention to all references to endianism anywhere near <span class="productname">FreeTDS</span>. See the section on <a class="link" href="configs.html#emulle" title="Big Endian Clients with Buggy Microsoft SQL Servers">Little Endian Emulation</a> for details.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Datetime"></a><span class="type">Datetime</span> and <span class="type">Money</span></h3></div></div></div><p>Big endian clients may experience difficulty with Microsoft servers. Some versions of <span class="productname">Microsoft SQL Server</span> 7 did not handle these types on these machines correctly, according to the protocol. According to <a class="ulink" href="http://support.microsoft.com/support/kb/articles/Q254/1/23.ASP" target="_top"> http://support.microsoft.com/support/kb/articles/Q254/1/23.ASP</a> on the Microsoft support site, it's fixed as of service pack 3. Unfortunately, there's no direct way for <span class="productname">FreeTDS</span> to know whether or not a service pack has been installed, and how/whether to support the buggy version is an outstanding issue. Your best bet is to apply their patch. </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.gif" /></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The Knowledge Base article states <span class="quote">“<span class="quote">The Sybase CT-Lib client is the only known big-endian client that can connect to <span class="productname">SQL Server</span>.</span>”</span> Depends on who's doing the knowing, of course.</p></td></tr></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="IntegratedSecurity"></a>Microsoft's <span class="quote">“<span class="quote">Integrated Security</span>”</span></h3></div></div></div><p><span class="productname">FreeTDS</span> may be unable to connect to the server. The error message will be <code class="computeroutput">"Login failed for user 'example'. Reason: Not associated with a trusted SQL Server connection"</code>. To solve this, turn on <span class="productname">SQL Server</span> authentication:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Open the <span class="emphasis"><em><span class="productname">Microsoft SQL Server</span> Enterprise Manager</em></span>,</p></li><li class="listitem"><p>Select the server,</p></li><li class="listitem"><p>Right mouse click and choose <span class="emphasis"><em>Properties</em></span>. A properties window will appear.</p></li><li class="listitem"><p>Choose the <span class="emphasis"><em>Security</em></span> tab. The security properties will be displayed.</p></li><li class="listitem"><p>Change the <span class="emphasis"><em>Authentication</em></span> field to <span class="emphasis"><em><span class="productname">SQL Server</span> and Windows</em></span>,</p></li><li class="listitem"><p>Apply the changes and try again.</p></li></ul></div><p>These instructions apply to Microsoft <span class="productname">SQL Server 7</span> and <span class="productname">SQL Server 2000</span>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.gif" /></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p><span class="productname">FreeTDS</span> supports integrated security mode, too. If you have <span class="productname">Microsoft SQL Server</span> running in integrated (domain) mode along with a Windows PDC, and wish to try it, see <a class="link" href="domains.html" title="Domain Logins">Domain Logins</a> in the <a class="link" href="configs.html" title="Chapter 5. Advanced Configurations">Advanced Configurations</a> chapter. If you have Active Directory you can also use Kerberos, see <a class="link" href="kerberos.html" title="Kerberos Support">Kerberos support</a>. </p></td></tr></table></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="uodbc.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="serverthere.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ODBC on Unix </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Is the server there?</td></tr></table></div></body></html>