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.

* This page is subject to Site terms.

More from Kontext

local_offer teradata local_offer python

visibility 222
thumb_up 0
access_time 2 months ago

Pandas is commonly used by Python users to perform data operations. In many scenarios, the results need to be saved to a storage like Teradata. This article shows you how to do that easily using JayDeBeApi or  ...

open_in_new View open_in_new Spark + PySpark

local_offer python

visibility 63
thumb_up 0
access_time 2 months ago

CSV is a common data format used in many applications. It's also a common task for data workers to read and parse CSV and then save it into another storage such as RDBMS (Teradata, SQL Server, MySQL). In my previous article  ...

open_in_new View open_in_new Python Programming

local_offer teradata local_offer python local_offer Java

visibility 135
thumb_up 0
access_time 2 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 ho...

open_in_new View open_in_new Python Programming

local_offer hadoop local_offer hive local_offer Java

visibility 192
thumb_up 1
access_time 2 months ago

When I was configuring Hive 3.0.0 in Hadoop 3.2.1 environment, I encountered the following error: Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V Ro...

open_in_new View open_in_new Hadoop

info About author

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward

Kontext Column

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


Learn more arrow_forward