Reputation: 12910
I am trying to connect to hive server using PyODBC
however I am getting error. Not sure how to resolve it.
HiveServer is running on EMR.
Code
import pyodbc
cnxnstr = 'Driver={/usr/lib/hive/lib/native/Linux-amd64-64/libhortonworkshiveodbc64.so};' \
'HiveServerType=2;' \
'Host=10.164.7.50;' \
'Port=10001;TransportMode=HTTP;' \
'UID=gshah03;' \
'AuthMech=3;' \
'ThriftTransport=SASL;' \
'Schema=my_database;' \
'PWD=mypass$'
cnxn = pyodbc.connect(cnxnstr, autocommit=True)
Error
Error: ('HY000', '[HY000] [unixODBC][Hortonworks][ThriftExtension] (5) Error occurred while contacting server: invalid sasl status. This could be because you are trying to establish a non-SSL connection to a SSL-enabled server. (5) (SQLDriverConnect)')
I tried adding this option as well, but not working 'sslverify=0; Option=3;'
Hive-Site.xml
<property>
<name>hive.server2.enable.doAs</name>
<value>false</value>
</property>
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
</property>
<property>
<name>hive.server2.thrift.http.port</name>
<value>10001</value>
</property>
Update:
with 10000
port, I am getting following error:
Error
Error: ('HY000', '[HY000] [unixODBC][Hortonworks][Hardy] (34) Error from server: connect() failed: Connection refused. (34) (SQLDriverConnect)')
Upvotes: 0
Views: 3250
Reputation: 13
Once the dsn is created , use that dsn in python using pyodbc and build a connection. Using this connection you can query out you hive tabes.
Upvotes: 1