title: Teradata connection string using Windows Authentication
body: <p>I am using Python3.6 and pyodbc to try and connect to Teradata. I need this for a script I want to hand off to an end user to update from data. I would prefer that each user not have to be instructed to setup their own DSN connection with a specific name I hard encode into the script.</p>
  
  <p>I think I have the driver correct now as well as the server and DB name. What I can't figure out is how to get the connection string to not require a username and password. 
  Helpful info:
  This is for windows OS. When I go to ODBC connections in windows, connection mechanism is listed as LDAP and i can connect through the Teradata program as well.</p>
  
  <p>What does work:
  Connection directly through the Teradata program (showing Teradata itself knows who I am)
  Using DSN="DSN_name" where DSN_Name is the name under ODBC connections found in windows. Showing I can connect via DSN.</p>
  
  <p>-Looking at ODBC Data Source Admin shows Driver matches what I have. "Server Name or ID" matches "servername" below.</p>
  
  <p>Tried:</p>
  
  <pre><code>connect_string = 'Driver={Teradata Database ODBC Driver 
  16.20};DBCName=servername;Database=db_name;MechanismName=LDAP;UseIntegratedSecurity=1;'
  con = pyodbc.connect(connect_string)
  </code></pre>
  
  <p>which gives:</p>
  
  <p>pyodbc.Error: ('HY000', '[HY000] [Teradata][ODBC] (11210) Operation not allowed during the transaction state. (11210) (SQLExecDirectW)')</p>
  
  <pre><code>connect_string = 'Driver={Teradata Database ODBC Driver 
  16.20};DBCName=servername;Database=db_name;MechanismName=LDAP;'
  con = pyodbc.connect(connect_string)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>connect_string = 'Driver={Teradata Database ODBC Driver 
  16.20};DBCName=servername;Database=db_name;Authentication=LDAP;'
  con = pyodbc.connect(connect_string)
  </code></pre>
  
  <p>which gives:
  pyodbc.InterfaceError: ('28000', '[28000] [Teradata][ODBC Teradata Driver] (2) Unable to logon with Authentication Mechanism selected. (2) (SQLDriverConnect)')</p>
  
  <p>I have also tried a few other suggested authentication mechanisms in addition to LDAP, but this is the one listed in Teradata and ODBC connections.</p>
  
  <p>In SQL_Server I use something like trusted_connection=yes to achieve the same effect I desire which doesn't seem to work in the above examples.</p>
  
  <pre><code>error:
  pyodbc.OperationalError: ('08001', '[08001] [Teradata][ODBC] (10380) Unable to establish connection 
  with data source. Missing settings: {[Password] [Username]} (10380) (SQLDriverConnect)')
  </code></pre>