For the past few days I have encountered an issue that I cannot explain. I am on Windows 10, Anaconda 64bits, Jupyter 64bits, Python 64bits, etc... I am a beginner and I need help. Thank you very much for the help which is greatly appreciated. I develop under anaconda jupyter notebook, I have a python script that connects to a Hive database using jdbc. I added a jar file which contains a java class org.apache.hive.jdbc.HiveDriver. When I run the script I got the following error:
TypeError: Class org.apache.hive.jdbc.HiveDriver is not found
Here is my python code
import jaydebeapi
driver = "org.apache.hive.jdbc.HiveDriver"
url = "jdbc:hive2://ip-172-31-3-208.eu-west-1.compute.internal:11000/default;principal=indexima/ip-172-31-3-208.eu-west-1.compute.internal@INDEXIMA.COM;"
hivejar = "C:/user/xxx/Documents/Python/hive-jdbc-3.1.2.jar"
#create connection and cursor
connection = jaydebeapi.connect(driver, [ url, '', ''], hivejar)
cursor = connection.cursor()
And the ouput is:
TypeError Traceback (most recent call last)
<ipython-input-15-3a47c2c3c553> in <module>
11
12 # create connection and cursor
---> 13 connection = jaydebeapi.connect(driver, [ url, '', ''], hivejar)
14 cursor = connection.cursor()
15
C:\ProgramData\Anaconda3\lib\site-packages\jaydebeapi\__init__.py in connect(jclassname, url, driver_args, jars, libs)
410 else:
411 libs = []
--> 412 jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
413 return Connection(jconn, _converters)
414
C:\ProgramData\Anaconda3\lib\site-packages\jaydebeapi\__init__.py in _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs)
219 return jpype.JArray(jpype.JByte, 1)(data)
220 # register driver for DriverManager
--> 221 jpype.JClass(jclassname)
222 if isinstance(driver_args, dict):
223 Properties = jpype.java.util.Properties
C:\ProgramData\Anaconda3\lib\site-packages\jpype\_jclass.py in __new__(cls, jc, loader, initialize)
97
98 # Pass to class factory to create the type
---> 99 return _jpype._getClass(jc)
100
101
**TypeError: Class org.apache.hive.jdbc.HiveDriver is not found**
The jar file contains of course the java class HiveDriver. I changed the name of the jar and replaced with any name, and I got the same diagnosis. It is as if Jupyter is going to look elsewhere. Thanks for your help.