title: RODBC not recognizing my odbc settings
body: <p>I'm running R 2.15.2 on a Red Hat Linux 6 server.  My goal is to connect to a MS SQL Server Database on another machine via RODBC.  I did my research and downloaded and installed the linux version of the MS SQL ODBC driver from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=28160" rel="noreferrer">the microsoft support website</a>.  I to had build unixODBC version 2.3.0 from source, because it is required by the windows driver and is not in the RHL repos yet (the repo version is 2.2.14).  </p>
  
  <p>Anyhow, after a bit of work, I finally got the driver installed and configured properly, and I can connect successfully to the SQL Server database via an <code>isql</code> command:</p>
  
  <pre><code>$ isql -v test testuser testpass
  +---------------------------------------+
  | Connected!                            |
  |                                       |
  | sql-statement                         |
  | help [tablename]                      |
  | quit                                  |
  |                                       |
  +---------------------------------------+
  SQL&gt;
  </code></pre>
  
  <p>so I know I have my <code>odbc.ini</code> and <code>odbcinst.ini</code> files properly set up.</p>
  
  <p>However, when I try to access the ODBC connection from within R, the following happens:</p>
  
  <pre><code>&gt; test &lt;- odbcDriverConnect('DSN=test;Database=RSQLTest01;Uid=testuser;Pwd=testpass')
  Warning messages:
  1: In odbcDriverConnect("DSN=test;Database=RSQLTest01;Uid=testuser;Pwd=testpass") :
     [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data 
     source name not found, and no default driver specified
  2: In odbcDriverConnect("DSN=test;Database=RSQLTest01;Uid=testuser;Pwd=testpass") :
     ODBC connection failed
  </code></pre>
  
  <p>Here's the result of the <code>odbcDataSources</code> command in R:</p>
  
  <pre><code>&gt; odbcDataSources()
  named character(0)
  </code></pre>
  
  <p>I have been doing some research and I think the solution (though I could be wrong) may have something to do with properly configuring the ODBC environment variables so that RODBC knows where to go to find <code>odbc.ini</code>. Based on my research, I found the following environment variables that may be relevant: <code>$ODBCINI, $ODBCSYSINI, $ODBC_ROOT $ODBC_INCLUDE, and $ODBC_LIBS.</code>  I have a reasonable idea of what these should be set to, but I'm not sure how to set them permanently, and so that RODBC can recognize where to find the appropriate files.</p>
  
  <p>Can anyone shed some light on this for me?  I'm not sure I properly understand how environment variables work in linux, and particularly why <code>isql</code> has no trouble connecting, but <code>RODBC</code> can't even find the driver/data source. </p>
  
  <p>NOTE: when I had the repo version of unixODBC installed, RODBC would install just fine using the <code>install.packages('RODBC')</code> command in R.  However, after I installed unixODBC 2.3.0 from source, the RODBC install would fail because of a dependency issue, and I had to install RODBC from source using the <a href="http://carlo-hamalainen.net/blog/2012/05/11/r-makeflags-rpath-and-building-packages/" rel="noreferrer">guide posted here</a>.  Is it possible I failed to configure ODBC properly to begin with and that's why I'm having troubles now?</p>