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

Change required for JPype 0.7.0 #102

Closed Thrameos closed 4 years ago

Thrameos commented 5 years ago

This deals with the startup. There are two additional differences.

def _handle_sql_exception_jpype():
    import jpype
    SQLException = jpype.java.sql.SQLException
    exc_info = sys.exc_info()
    if issubclass(exc_info[1].__javaclass__, SQLException):
        exc_type = DatabaseError
    else:
        exc_type = InterfaceError
    reraise(exc_type, exc_info[1], exc_info[2])

Exceptions in 0.7 now catch the exception type directly rather than as part of the arguments to the exception.

baztian commented 4 years ago

I think I've already merged/integrated the changes of this PR. Thanks @Thrameos !