我正在尝试使用jaydebeapi Python库连接到Hive服务器,但是遇到了错误。我对JAVA不太熟悉。可能出了什么问题,或者我该如何进行调试?
./beeline-jdbc.py
CLASSPATH is :/usr/hdp/2.4.3.0-227/hadoop/conf:/usr/hdp/2.4.3.0-227/hadoop/lib/*:/usr/hdp/2.4.3.0-227/hadoop/.//*:/usr/hdp/2.4.3.0-227/hadoop-hdfs/./:/usr/hdp/2.4.3.0-227/hadoop-hdfs/lib/*:/usr/hdp/2.4.3.0-227/hadoop-hdfs/.//*:/usr/hdp/2.4.3.0-227/hadoop-yarn/lib/*:/usr/hdp/2.4.3.0-227/hadoop-yarn/.//*:/usr/hdp/2.4.3.0-227/hadoop-mapreduce/lib/*:/usr/hdp/2.4.3.0-227/hadoop-mapreduce/.//*::mysql-connector-java-5.1.37:mysql-connector-java-5.1.37-bin.jar:mysql-connector-java-5.1.37.zip:mysql-connector-java.jar:/usr/hdp/2.4.3.0-227/tez/*:/usr/hdp/2.4.3.0-227/tez/lib/*:/usr/hdp/2.4.3.0-227/tez/conf:/usr/hdp/current/hadoop-client/*:/usr/hdp/current/hive-client/lib/*:/usr/hdp/current/hadoop-client/client/*
Traceback (most recent call last):
File "./beeline-jdbc.py", line 18, in <module>
, hivejar)
File "/home/dev/lib/JayDeBeApi-1.0.0-py2.6.egg/jaydebeapi/__init__.py", line 380, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/home/dev/lib/JayDeBeApi-1.0.0-py2.6.egg/jaydebeapi/__init__.py", line 199, in _jdbc_connect_jpype
return jpype.java.sql.DriverManager.getConnection(url, *dargs)
RuntimeError: No matching overloads found. at native/common/jp_method.cpp:117
一个脚本:
#!/usr/bin/env python
import jaydebeapi
import os
principal='hive/dev15-namenode-01.example.com@example.COM'
server='localhost'
port=10000
database='tsz'
hivejar='/usr/hdp/current/hive-client/lib/hive-jdbc.jar'
url=("jdbc:hive2://" + server + ":" + str(port) + "/default;principal="
+ principal + ";")
print 'CLASSPATH is '+os.environ['CLASSPATH']
c=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", [ url, '', '']
, hivejar)
cursor=c.cursor()
NoneType
,而我可以从DataGrip查询它。请问您能否帮助我找出连接是否正确建立的方法? - Mostafa Ghadimi