<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML ><HEAD ><TITLE >Environment variables</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="FreeTDS User Guide" HREF="index.htm"><LINK REL="UP" TITLE="Install FreeTDS" HREF="install.htm"><LINK REL="PREVIOUS" TITLE="The locales.conf file" HREF="locales.htm"><LINK REL="NEXT" TITLE="Port override syntax" HREF="portoverride.htm"><LINK REL="STYLESHEET" TYPE="text/css" HREF="userguide.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><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 WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="locales.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 3. Install <SPAN CLASS="PRODUCTNAME" >FreeTDS</SPAN ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="portoverride.htm" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="ENVVAR" >Environment variables</A ></H1 ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="WHATFOR" >What they're for</A ></H2 ><P >You can use environment variables to <P ></P ><UL ><LI ><P >Override some of the settings in <SPAN CLASS="PRODUCTNAME" >FreeTDS</SPAN >'s configuration file.</P ></LI ><LI ><P >Advertise the location of the <SPAN CLASS="PRODUCTNAME" >FreeTDS</SPAN > libraries to programs that want them.</P ></LI ><LI ><P >Control how logging is done.</P ></LI ></UL > This section covers the first two items. For information about environment variables that control logging, see <A HREF="logging.htm" >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 ><P ></P ><DIV CLASS="VARIABLELIST" ><P ><B >Environment Variables</B ></P ><DL ><DT ><CODE CLASS="ENVAR" >FREETDS</CODE ></DT ><DD ><P >may be used to specify the name and location of the <TT CLASS="FILENAME" >freetds.conf</TT > file. In prior versions of <SPAN CLASS="PRODUCTNAME" >FreeTDS</SPAN > this variable was known as <CODE CLASS="ENVAR" >FREETDSCONF</CODE >.</P ></DD ><DT ><CODE CLASS="ENVAR" >TDSVER</CODE ></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 ><P ></P ><OL TYPE="1" ><LI ><P >The value specified in <CODE CLASS="ENVAR" >TDSVER</CODE ></P ></LI ><LI ><P >A <TT CLASS="FILENAME" >freetds.conf</TT > file entry (see below)</P ></LI ><LI ><P >The <TT CLASS="FILENAME" >interfaces</TT > file entry (see below)</P ></LI ><LI ><P >The <CODE CLASS="OPTION" >--with-tdsver</CODE > option passed to <B CLASS="COMMAND" >configure</B ></P ></LI ></OL ></DD ><DT ><CODE CLASS="ENVAR" >TDSPORT</CODE ></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, 4000 for TDS 5.0) as well as any port specified in the <TT CLASS="FILENAME" >freetds.conf</TT > file.</P ></DD ><DT ><CODE CLASS="ENVAR" >SYBASE</CODE ></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" >"SYBASE"</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 <TT CLASS="FILENAME" >interfaces</TT > file (if used, see the <A HREF="interfacesfile.htm" >Appendix</A >), which some programs examine directly.</P ></DD ><DT ><CODE CLASS="ENVAR" >TDSQUERY</CODE >, <CODE CLASS="ENVAR" >DSQUERY</CODE ></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 ><CODE CLASS="ENVAR" >TDSHOST</CODE ></DT ><DD ><P >overrides the host specified in the <TT CLASS="FILENAME" >freetds.conf</TT >.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="SETTING" >Setting environment variables</A ></H2 ><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: <PRE CLASS="SCREEN" > <SAMP CLASS="PROMPT" >$ </SAMP ><KBD CLASS="USERINPUT" >export SYBASE=/usr/local/freetds</KBD > # (or your favorite directory) <SAMP CLASS="PROMPT" >$ </SAMP ><KBD CLASS="USERINPUT" >export TDSVER=4.2</KBD ></PRE ></P ><P >In <SPAN CLASS="APPLICATION" >csh</SPAN >: <PRE CLASS="SCREEN" > <SAMP CLASS="PROMPT" >$ </SAMP ><KBD CLASS="USERINPUT" >setenv SYBASE /usr/local/freetds</KBD > <SAMP CLASS="PROMPT" >$ </SAMP ><KBD CLASS="USERINPUT" >setenv TDSVER 4.2</KBD ></PRE ></P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="CHECKING" >Checking your work</A ></H2 ><P >When you're done, you should see something very like this: <PRE CLASS="SCREEN" > <SAMP CLASS="PROMPT" >$ </SAMP ><KBD CLASS="USERINPUT" >ls $SYBASE</KBD > <SAMP CLASS="COMPUTEROUTPUT" >etc include interfaces lib</SAMP ></PRE ></P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="locales.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.htm" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="portoverride.htm" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The <TT CLASS="FILENAME" >locales.conf</TT > file</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="install.htm" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Port override syntax</TD ></TR ></TABLE ></DIV ></BODY ></HTML >