baztian / jaydebeapi

JayDeBeApi module allows you to connect from Python code to databases using Java JDBC. It provides a Python DB-API v2.0 to that database.
GNU Lesser General Public License v3.0
364 stars 147 forks source link

Is this jaydebeapi support phoenix on python3.5? #124

Open luzongyi opened 4 years ago

luzongyi commented 4 years ago

I found so many webpages show me how to connect to phoenix.They all looks like the code down below,But that's not working.Do any one know how to do it? Please tell me.Thanks.

import jpype
import jaydebeapi

phoenix_client_jar = r"D:\Python\TestFile\lib\phoenix-5.0.0.3.1.0.0-78-client.jar"
args = '-Djava.class.path=%s' % phoenix_client_jar
jvm_path = jpype.getDefaultJVMPath()
jpype.startJVM(jvm_path, args)
conn = jaydebeapi.connect('org.apache.phoenix.jdbc.PhoenixDriver',
                          'jdbc:phoenix:wmshadooptest60,wmshadooptest58,wmshadooptest59:2181', ['', ''],
                          phoenix_client_jar)
print("test info....")
curs = conn.cursor()
sql = "select * from SYSTEM.CATALOG limit 1"
count = curs.execute(sql)
results = curs.fetchall()
for r in results:
    print(r)

I only got this outcome:

C:\Python35\python.exe D:/Python/TestFile/phoenix_query.py
C:\Python35\lib\site-packages\jpype\_core.py:210: UserWarning: 
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False.  The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------

  """)
log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
baztian commented 4 years ago

@luzongyi can you check whether this issue has been fixed with JayDeBeApi 1.2.1?