JezK
Edit File: envvar.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>Environment variables</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="install.html" title="Chapter 3. Install FreeTDS" /><link rel="prev" href="locales.html" title="The locales.conf file" /><link rel="next" href="PortOverride.html" title="Port/instance override syntax" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Environment variables</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="locales.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Install <span class="productname">FreeTDS</span></th><td width="20%" align="right"> <a accesskey="n" href="PortOverride.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="envvar"></a>Environment variables</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Whatfor"></a>What they're for</h3></div></div></div><p>You can use environment variables to </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Override some of the settings in <span class="productname">FreeTDS</span>'s configuration file.</p></li><li class="listitem"><p>Advertise the location of the <span class="productname">FreeTDS</span> libraries to programs that want them.</p></li><li class="listitem"><p>Control how logging is done.</p></li></ul></div><p> This section covers the first two items. For information about environment variables that control logging, see <a class="link" href="logging.html" title="Logging">Logging</a></p><p>In a typical system, no environment variables need be used. They're sometimes handy for testing, for instance setting <code class="envar">TDSVER</code> to check if a connection problem is due to using the wrong protocol version. And they have other uses, described below. But they're just knobs, so don't feel you have to turn every one, unless you're the sort that likes turning knobs.</p><div class="variablelist"><a id="tab.environment.variables"></a><p class="title"><strong>Environment Variables</strong></p><dl class="variablelist"><dt><span class="term"><a id="FREETDS"></a><code class="envar">FREETDS</code></span></dt><dd><p>may be used to specify the name and location of the <code class="filename">freetds.conf</code> file. In prior versions of <span class="productname">FreeTDS</span> this variable was known as <code class="envar">FREETDSCONF</code>.</p></dd><dt><span class="term"><a id="TDSVER"></a><code class="envar">TDSVER</code></span></dt><dd><p>governs the version of the <acronym class="acronym">TDS</acronym> protocol used to connect to your server. For a given server, <span class="productname">FreeTDS</span> inspects four sources in the following order to determine which <acronym class="acronym">TDS</acronym> protocol version to use, using the first one it finds.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>The value specified in <code class="envar">TDSVER</code> </p></li><li class="listitem"><p>A <code class="filename">freetds.conf</code> file entry (see below) </p></li><li class="listitem"><p>The <code class="filename">interfaces</code> file entry (see below) </p></li><li class="listitem"><p>The <code class="option">--with-tdsver</code> option passed to <span class="command"><strong>configure</strong></span> </p></li></ol></div></dd><dt><span class="term"><a id="TDSPORT"></a><code class="envar">TDSPORT</code></span></dt><dd><p>specifies a TCP port number at which the servername is listening. It overrides the default port (1433 for TDS 4.2/7.0/7.1/7.2/7.3/7.4, 4000 for TDS 5.0) as well as any port specified in the <code class="filename">freetds.conf</code> file.</p></dd><dt><span class="term"><a id="SYBASE"></a><code class="envar">SYBASE</code></span></dt><dd><p>points to the <span class="productname">FreeTDS</span> run-time directory. Use of this variable originated with Sybase (the company), and many programs still rely on <code class="envar">SYBASE</code> to discover the location of the <span class="quote">“<span class="quote">SYBASE</span>”</span> libraries.</p><p>The primary use of <code class="envar">SYBASE</code> is to advertise the location of the <span class="productname">FreeTDS</span> libraries. A secondary use is to point to the location of the <code class="filename">interfaces</code> file (if used, see the <a class="link" href="interfacesfile.html" title="Appendix B. The interfaces File">Appendix</a>), which some programs examine directly.</p></dd><dt><span class="term"><a id="TDSQUERY"></a><code class="envar">TDSQUERY</code> , </span><span class="term"><a id="DSQUERY"></a><code class="envar">DSQUERY</code></span></dt><dd><p>provides a server name to connect to if none is specified by the application. <code class="envar">DSQUERY</code> is the historical Sybase name for this variable.</p></dd><dt><span class="term"><a id="TDSHOST"></a><code class="envar">TDSHOST</code></span></dt><dd><p>overrides the host specified in the <code class="filename">freetds.conf</code>.</p></dd></dl></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Setting"></a>Setting environment variables</h3></div></div></div><p>Of course, each shell is a little different. In the Bourne shell and variants such as <span class="application">ksh</span> and <span class="application">bash</span>, to set <code class="envar">SYBASE</code> and <code class="envar">TDSVER</code> do: </p><pre class="screen"> <code class="prompt">$ </code><strong class="userinput"><code>export SYBASE=/usr/local/freetds</code></strong> # (or your favorite directory) <code class="prompt">$ </code><strong class="userinput"><code>export TDSVER=7.4</code></strong></pre><p>In <span class="application">csh</span>: </p><pre class="screen"> <code class="prompt">$ </code><strong class="userinput"><code>setenv SYBASE /usr/local/freetds</code></strong> <code class="prompt">$ </code><strong class="userinput"><code>setenv TDSVER 7.4</code></strong></pre></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Checking"></a>Checking your work</h3></div></div></div><p>When you're done, you should see something very like this: </p><pre class="screen"> <code class="prompt">$ </code><strong class="userinput"><code>ls $SYBASE</code></strong> <code class="computeroutput">etc include interfaces lib</code></pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="locales.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="install.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="PortOverride.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The <code class="filename">locales.conf</code> file </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Port/instance override syntax</td></tr></table></div></body></html>