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
365 stars 148 forks source link

Netezza connection throws NullPointerException #103

Open JituS opened 5 years ago

JituS commented 5 years ago
url='jdbc:netezza://XX.XXX.X.XXX:5480/default;loglevel=3;logdirpath=/path/to/logs";'
dargs=["user", "password"]
try:
     jpype.java.sql.DriverManager.getConnection(url, *dargs)
 except jpype.JavaException as exception:
     print(exception.message())
     print(exception.stacktrace())

java.lang.NullPointerException at org.netezza.sql.NzConnection$Initializer.handshake(NzConnection.java:2163) at org.netezza.sql.NzConnection$Initializer.init(NzConnection.java:2091) at org.netezza.sql.NzConnection.open(NzConnection.java:298) at org.netezza.datasource.NzDatasource.getConnection(NzDatasource.java:719) at org.netezza.datasource.NzDatasource.getConnection(NzDatasource.java:706) at org.netezza.Driver.connect(Driver.java:155) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247)

Netezza Driver at line 1866 int index = System.getProperty("sun.java.command").indexOf(32, 0); expects sun.java.command property to be set, which is not set while starting up jvm in jaydebeapi. thus fails with NullPointerException.