Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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

avatar
Expert 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

avatar
Rising Star

@subash sharma How did you solve this?

avatar
Expert 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()