AttributeError: type object 'java.sql.Types' has no attribute '__javaclass__'

visibility 3,385 comment 1 event 2020-04-10 access_time 4 years ago language English

In my previous article Connect to SQL Server via JayDeBeApi in Python, I showed examples of using Python package jaydebeapi to connect to SQL Server via JDBC.

The code was working properly. However after I reinstall Python 3.8.2 x64 version on Windows, I'm getting a new error:

***\lib\site-packages\jaydebeapi\", line 182, in _jdbc_connect_jpype
    for i in types.__javaclass__.getClassFields():
AttributeError: type object 'java.sql.Types' has no attribute '__javaclass__'

This error can happen when connecting to Oracle, Teradata, SQLite, SQL Server, Hive, MySQL and PostgreSQL via JDBC driver..


The root cause of this issue is with JPype1 package  which JayDeBeApi package relies on.  My version is 0.7.2 (the latest as at 2020-04-10).

To fix it, I downgrade its version to 0.6.3 using the following command:

pip install --upgrade jpype1==0.6.3 --user

After downgrade the version, the code snippet in my previous article now works properly again.

There is one GitHub issue related to this:

More from Kontext
copyright This page is subject to Site terms.
Like this article?
Share on
comment Comments
access_time 3 years ago link more_vert
#316 Re: AttributeError: type object 'java.sql.Types' has no attribute '__javaclass__'

According to, this issue has now been fixed.

This problem has been fixed , just upgrade to JayDeBeApi to 1.2.3, JPype1 to 0.7.5

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts