1.sql developer(客户端)
- 下载Oracle SQL Developer(http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html )
2.Hive驱动程序
(1)下载驱动程序
https://www.cloudera.com/downloads/connectors/hive/jdbc/2-6-1.html
(2)工具–>首选项
(3)左侧定位到“数据库”–>“第三方JDBC驱动程序”,右侧窗口单击“添加条目”按钮来添加Hive驱动程序
tip:1.连接的主机ip是(HiveServer2所在的机子)
2.用户名和密码在HiveServer2所在的机子里面的hive-site.xml文件里面配: - python连接hive
一.impyla方式连接
准备工作
1.安装
1、pip install six
2.pip install sasl
3、pip install thriftpy[hive]
4.pip install thrift_sasl (pip install thrift-sasl==0.2.1)
安装错误。根据提示下载包
链接:https://www.lfd.uci.edu/~gohlke/pythonlibs/ (包含各种包)
5.pip install impyla
测试:
> from impala.dbapi import connect
> conn = connect(host='HiveServer2所在的机子ip',port = 10000,auth_mechanism='PLAIN',user='root',password='root',database='myhive')
> cur=conn.cursor()
> cur.execute('select * from student')
> print(cur.fetchall())
> cur.close()
> conn.close()
二.PyHive方式连接
准备工作
1.安装
1、pip install six
2.pip install sasl
3、pip install thriftpy[hive]
4.pip install thrift_sasl (pip install thrift_sasl==0.3.0)
安装错误。根据提示下载包
链接:https://www.lfd.uci.edu/~gohlke/pythonlibs/ (包含各种包)
(如果没安装wheel记得先安装wheel:pip install wheel)
5.pip install PyHive
测试:
from pyhive import hive
conn = hive.connect(host='192.168.84.162',port = 10000,username='root')
cur=conn.cursor()
cur.execute('show databases')
print(cur.fetchall())
cur.close()
conn.close()