无法在python中将netezza DB与jaydebeapi连接

时间:2019-03-28 09:20:33

标签: python netezza jaydebeapi

@Team

从python连接netezza DB时出现以下异常

例外:

jpype._jexception.RuntimeExceptionPyRaisable:java.lang.RuntimeException:找不到类org.netezza.Driver

任何人,请帮助我解决此问题。

 Code:
import jaydebeapi,sys
import os

dsn_database = "XXXXX"
dsn_hostname = "XXXXXl"
dsn_port = "5480"
dsn_uid = "XXX"
dsn_pwd = "XXXX"
jdbc_driver_name = "org.netezza.Driver"
jdbc_driver_loc = os.path.join(r'C:\Test\netezza-3.2.2.jar')

sql_str = "select now()" 
connection_s`tring='jdbc:netezza://'+dsn_hostname+':'+dsn_port+'/'+dsn_database
    url = '{0}:user={1};password={2}'.format(connection_string, dsn_uid, 
    dsn_pwd)
    print("Connection String: " + connection_string)
    conn = jaydebeapi.connect(jdbc_driver_name, connection_string, {'user': 
    dsn_uid, 'password': dsn_pwd},jars=jdbc_driver_loc)
    curs = conn.cursor()
    curs.execute(sql_str)
    result = curs.fetchall()
    print(result[0])

谢谢 SG

0 个答案:

没有答案