title: Teradata pypyodbc SQL_INVALID_HANDLE
body: <p>While connecting <strong>pypyodbc</strong> with teradata i am getting SQL_INVALID_HANDLE</p>
  
  <p>OS - Red Hat  4.4.7-17</p>
  
  <p>Python Version - 2.6.6</p>
  
  <p>I am not having administrative privilages to install the pypyodbc so i have downloaded the module, set pythonpath and imported it.</p>
  
  <p>Done the required exports to point the python module to find the correct libodbc.so</p>
  
  <pre><code>export LD_LIBRARY_PATH=/opt/teradata/client/15.10/odbc_64/lib/
  export ODBCINST=/opt/teradata/client/ODBC_64/odbcinst.ini
  export ODBCINI=/opt/teradata/client/ODBC_64/odbc.ini
  </code></pre>
  
  <p>used the below code to create a db connection</p>
  
  <pre><code>pypyodbc.connect("Driver={Teradata};DBCNAME=&lt;DB&gt;;UID=&lt;UNAME&gt;;PWD=&lt;PASS&gt;")
  </code></pre>
  
  <p>The odbc connection string i have used is correct. I have tested using the below approach</p>
  
  <pre><code>/opt/teradata/client/15.10/bin/tdxodbc64 -C "Driver={Teradata};DBCNAME=&lt;DB&gt;;UID=&lt;UNAME&gt;;PWD=&lt;PASS&gt;"
  </code></pre>
  
  <p>**Note:**I am not using teradata OOTB python module because it works with a higher version of python which i cannot install.</p>
  
  <p>Error</p>
  
  <pre><code>  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "&lt;LOCAL_PATH&gt;/pypyodbc.py", line 2421, in __init__
      AllocateEnv()
    File "&lt;LOCAL_PATH&gt;/pypyodbc.py", line 1000, in AllocateEnv
      check_success(SQL_NULL_HANDLE, ret)
    File "&lt;LOCAL_PATH&gt;/pypyodbc.py", line 990, in check_success
      ctrl_err(SQL_HANDLE_ENV, ODBC_obj, ret, False)
    File "&lt;LOCAL_PATH&gt;/pypyodbc.py", line 970, in ctrl_err
      raise ProgrammingError('', 'SQL_INVALID_HANDLE')
  pypyodbc.ProgrammingError: ('', 'SQL_INVALID_HANDLE')
  </code></pre>
  
  <p>any guidance on the matter is helpful</p>