Member since
03-27-2020
5
Posts
1
Kudos Received
0
Solutions
05-19-2020
08:09 AM
1 Kudo
I think it was because if you use kerberos, the kerberos credentials have to be in upper case because they are case sensitive
... View more
03-30-2020
09:54 AM
The DSN-less connection string below FINALLY worked for me, in windows 10. I created a file DSN, then copy/pasted the string into the python code, as a template. Three lessons that I learned from this struggle: 1) kerberos is CASE SENSITIVE. Your kerberos realm in the string MUST be uppercase. 2) The Cloudera driver doesn't like spaces in between the semicolons in the string. Avoid them. 3) If you don't need connection pooling, turn it off with a pyodbc.pooling = False statement. import pyodbc strFileDSNAsAstring = "DRIVER=Cloudera ODBC Driver for Apache Hive;USEUNICODESQLCHARACTERTYPES=1; \ SSL=0;SERVICEPRINCIPALCANONICALIZATION=0;SERVICEDISCOVERYMODE=0;SCHEMA=database;PORT=port; \ KRBSERVICENAME=hive;KRBREALM=uppercaserealm;KRBHOSTFQDN=hostfqdndomain;INVALIDSESSIONAUTORECOVER=1; \ HOST=host;HIVESERVERTYPE=2;GETTABLESWITHQUERY=0;ENABLETEMPTABLE=0;DESCRIPTION=Hive; \ DELEGATEKRBCREDS=0;AUTHMECH=1;ASYNCEXECPOLLINTERVAL=100;APPLYSSPWITHQUERIES=1;CAIssuedCertNamesMismatch=1;" try: pyodbc.pooling = False conn = pyodbc.connect(strFileDSNAsAstring, autocommit=True) except: print("failure.") else: conn.close() print("success.")
... View more
03-27-2020
04:08 PM
...but WHERE did you put those parameters? I am having the same issue. My file DSN will connect just fine in the ODBC Administrator applet, but in pyodbc it gives the same error. Did you add those parameters to your DSN?
... View more
03-27-2020
03:38 PM
Sigh. I've looked at literally dozens of forum posts, and every single one has a different connection string. 'this works for me'. 'that works for me'. 'you have to have thrift.py version whatever. ' 'this set of modules with these specific versions work for me.' It's hopeless. there is simply NO generalized version of an ODBC or OLEDB connection string that will work to connect to a kerberized hive 2 server. For SQL server it's so eeeasy and siiimple, and it ALWAYS works if you have the right drivers setup: TheConnectionString = "DRIVER={SQL Server};" & _ "SERVER=servername;" & _ "Database=databasename;" & _ "UID=windowsuserid;" & _ "PWD=windowspassword" So apparently for python connecting to hiveserver 2 you have to experiment and experiment and experiment for a long, long time trying dozens of different strings, and then one of them will FINALLY work.
... View more