baztian/jaydebeapi

__javaclass__ AttributeError with with jPype 1.2.0 and jtds Driver

theglob opened this issue · 3 comments

Hi,

so the previously fixed Problem (
https://github.com/baztian/jaydebeapi/issues/131) seems to be there again with jPype version 1.2.0

I am using:

Python 3.6
Driver: net.sourceforge.jtds.jdbc.Driver
Version: jtds-1.3.1

Everything worked fine with jpype1-0.6.3 until i recently encountered an Exception associated with jpype
https://github.com/jpype-project/jpype/issues/290#issuecomment-746678533. This issue could be solved by manually checking running JVMs. However i was advised to not use the fix and instead upgrade to 1.2.0.

After upgrading i encountered the old Attributeerror caused by jaydebeapi:

File "/database.py", line 183, in connect
engine = jaydebeapi.connect(driver_name, conn_str, props, jar_path)
File "/Users/miroconzelmann/opt/anaconda3/envs/testenv/lib/python3.6/site-packages/jaydebeapi/init.py", line 381, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/opt/anaconda3/envs/testenv/lib/python3.6/site-packages/jaydebeapi/init.py", line 182, in _jdbc_connect_jpype
for i in types.javaclass.getClassFields():
AttributeError: type object 'java.sql.Types' has no attribute 'javaclass'

What version of jaybedeapi?

JayDeBeApi 1.1.1
Ok, i just saw that the issue should be fixed with the current 1.2.3

Just tried it and it worked.

Thanks anyway :)

Okay I was going to say that error looks a lot like old versions. JayDeBeAPI was accessing private fields that were removed in later versions of JPype, so you have to use the later version which is aware of the changes.