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

access_time 7 months ago visibility1863 comment 1

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\__init__.py", 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..

Resolution

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: https://github.com/baztian/jaydebeapi/issues/131.

copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer kafka local_offer python

visibility 105
thumb_up 0
access_time 2 months ago

Apache Kafka is written with Scala. Thus, the most natural way is to use Scala (or Java) to call Kafka APIs, for example, Consumer APIs and Producer APIs. For Python developers, there are open source packages available that function similar as official Java clients.  This article shows you ...

local_offer teradata local_offer python local_offer Java local_offer python-database

visibility 1177
thumb_up 0
access_time 7 months ago

Python JayDeBeApi module allows you to connect from Python to Teradata databases using Java JDBC drivers. In article Connect to Teradata database through Python , I showed how to use teradata package to connect to Teradata via Teradata ODBC driver. This article demos how to use this JayDeBeApi ...

local_offer teradata local_offer t-sql local_offer mssql local_offer SQL local_offer SQL Server local_offer teradata-sql-query

visibility 4311
thumb_up 0
access_time 6 years ago

For Teradata developers, if you have no SQL Server installed, please go to the following link to download the SQL Server 2014 Expression Edition. http://www.microsoft.com/en-us/server-cloud/Products/sql-server-editions/sql-server-express.aspx It is easy to get started and free to use.

About column