title: Installing Cloudera Impala ODBC drivers for RODBC
body: <p>I have tried to very carefully follow the installation guide for setting up Impala Cloudera ODBC drivers for R on a mac, but keep getting the following error message: </p>
  
  <pre><code>In odbcDriverConnect("DSN=Impala ODBC Driver") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver
  Manager]Data source name not found, and no default driver specified
  </code></pre>
  
  <p>Here's exactly what I did. For each file referenced below, I made sure the file exists at that location.</p>
  
  <p>Download and install the Impala ODBC driver from <a href="http://www.cloudera.com/content/cloudera/en/downloads/connectors/impala/odbc/impala-odbc-v2-5-23.html" rel="nofollow">http://www.cloudera.com/content/cloudera/en/downloads/connectors/impala/odbc/impala-odbc-v2-5-23.html</a></p>
  
  <pre><code>brew install unixodbc
  odbcinst -j 
  
  unixODBC 2.3.2
  DRIVERS............: /usr/local/etc/odbcinst.ini
  SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
  FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
  USER DATA SOURCES..: /Users/summerrae/.odbc.ini
  SQLULEN Size.......: 8
  SQLLEN Size........: 8
  SQLSETPOSIROW Size.: 8
  </code></pre>
  
  <p>Pointed the DYLD library path variable:</p>
  
  <pre><code>export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/cloudera/impalaodbc/lib/universal
  
  echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/cloudera/impalaodbc/lib/universal/" &gt;&gt; ~/.bashrc
  </code></pre>
  
  <p>Edited /usr/local/etc/odbc.ini: </p>
  
  <pre><code>[ODBC Data Sources]
  # Use this name in your connection string 
  Impala DSN=Impala ODBC Driver
  [Impala DSN]
  # Driver: The location where the ODBC driver is installed to. 
  Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
  # Values for HOST, PORT, Database 
  HOST=myhost (changed name here for security)
  PORT=21050
  Database=default
  
  Edited /user/local/etc/odbcinst.ini: 
  [ODBC Drivers]
  Impala ODBC Driver=Installed
  [Impala ODBC Driver]
  Description=Impala ODBC Driver
  Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
  </code></pre>
  
  <p>Edited /opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini:</p>
  
  <pre><code>[Driver]
  ## - Note that this default DriverManagerEncoding of UTF-15 
  ## is for unixODBC. 
  DriverManagerEncoding=UTF-16
  ErrorMessagesPath=/opt/cloudera/impalaodbc/ErrorMessages/
  LogLevel=0
  LogPath=
  
  ## - Note that the path to your ODBC Driver Manager 
  ## must be specified in DYLD_LIBRARY_PATH.
  # unixODBC 
  ODBCInstLib=libiodbcinst.dylib
  </code></pre>
  
  <p>Exported path variables to ~/.bashrc: </p>
  
  <pre><code>#add full path to odbc.ini and add to bashrc
  export ODBCINI=/usr/local/etc/odbc.ini
  echo "export ODBCINI=/etc/odbc.ini" &gt;&gt; ~/.bashrc
  
  #add directory path to odbcinst.ini and add to bashrc
  export ODBCSYSINI=/usr/local/etc/
  echo "export ODBCSYSINI=/etc/odbcinst.ini" &gt;&gt; ~/.bashrc
  
  #add full path to cloudera.impalaodbc.ini and add to bashrc
  export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini
  echo "export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini" &gt;&gt; ~/.bashrc
  </code></pre>
  
  <p>In R: </p>
  
  <pre><code>install.packages("RODBC")
  library(RODBC)
  #connect using impala DSN
  conn &lt;- odbcConnect("Impala DSN")
  </code></pre>
  
  <p>I have gone through every tutorial I can find to get this to work. I am able to connect to the same server and parameters using Python, I am able to connect to the same server using RImpala, but can't get the RImpala package to run queries, so I know the connection works. Any help is greatly appreciated. Thanks! </p>