Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Issue while connecting to phoenix via Python with phoenixdb

New Contributor

Hi, as in title I'm actually trying to connect Phoenix via Python3 with phoenixdb packages. I already made this connection with DBeaver and everything works fine, except that it seems to be required a very long list of drivers in order to set it up. Luckily dbeaver did it almost by itself and when I see driver properties it returns me this long lists of jars (alleged image) needed to connected to Phoenix. On the otherside if I look Phoenix documentation it seems to be needed only phoenix-hbase-client driver. I'm little confused but I tried

import phoenixdb.cursor<br><br>conn = phoenixdb.connect('<hostname-used-in-dbeaver-connection>', autocommit=True, )<br><br>cursor = conn.cursor()

and it returns me:

File "C:\Python 3.6.5\lib\site-packages\phoenixdb\avatica.py", line 158, in connect  raise errors.InterfaceError('Unable to connect to the specified service', e)phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service', ConnectionRefusedError(10061


What am I missing?

Furthermore I tried also with jaydebeapi package:

import jaydebeapi
conn = jaydebeapi.connect("org.apache.phoenix.jdbc.PhoenixDriver", 'jdbc:phoenix:<hostname-used-in-dbeaver-connection>', r'C:\Users\LENOVO2\Desktop\phoenix-core-4.5.2-HBase-0.98.jar') 

but in this case I get:

File "C:\Python 3.6.5\lib\site-packages\jaydebeapi\__init__.py", line 381, in connect  jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)  File "C:\Python 3.6.5\lib\site-packages\jaydebeapi\__init__.py", line 190, in _jdbc_connect_jpype  jpype.JClass(jclassname)  File "C:\Python 3.6.5\lib\site-packages\jpype\_jclass.py", line 73, in JClass  raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class org.apache.phoenix.jdbc.PhoenixDriver not found

76602-jar.png

1 REPLY 1

I'm not that much familiar with the driver you are using but recently we incorporated https://github.com/lalinsky/python-phoenixdb.

For usage:-

http://python-phoenixdb.readthedocs.io/en/latest/

Related jira:-

https://issues.apache.org/jira/browse/PHOENIX-4636

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.