Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to connect to Hive through Knox using JDBC in python ?

How to connect to Hive through Knox using JDBC in python ?

New Contributor

Hi,

I would like to connect to Hive via Knox using JDBC connection in python. Please note that my cluster is secured and SSL is enabled and we use LDAP to Login to Hive via Knox.I am able to establish the connection to Hive using DbViz and JDBC driver of Hive. I had gone through a lot of links and haven't found any good examples as well as recommendations to connect hive using python.

Thank you in Advance,

Subash

2 REPLIES 2

Re: How to connect to Hive through Knox using JDBC in python ?

Contributor

@subash sharma How did you solve this?

Highlighted

Re: How to connect to Hive through Knox using JDBC in python ?

New Contributor

Hey @J Koppole,

I connected to hive using JayDeBeApi python package. To establish JDBC Connection, Download Hive Uber JDBC Jar created by @Tim Veil.

Steps to connect has been mentioned on JayDeBeApi link:

I am pasting sample code snippet below

import jaydebeapi;
conn = jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver","<hive_jdbc_url>",["<username>", "<password>"],"/path/to/hive-jdbc-uber-<version>.jar")
curs = conn.cursor();
curs.execute("select * from some_table");
curs.close()
Don't have an account?
Coming from Hortonworks? Activate your account here