Skip to content

Errors using JayDeBeApi #71

@mikrom-work

Description

@mikrom-work
  • itoolkit version: 1.7.0
  • Python version:
  • OS Name and Version: Windows 10
  • IBM i version: V7R3
  • XMLSERVICE version:

Describe the bug

I'm using JayDeBeApi 1.2.3 and jt400.jar with itoolkit 1.7.0 and tried executing some commands on IBM i using database transport.
I got following errors:

  File "C:\Python35\lib\site-packages\itoolkit\itoolkit.py", line 1173, in call
    xml_out = itrans.call(self)
  File "C:\Python35\lib\site-packages\itoolkit\transport\base.py", line 47, in call
    return self._call(tk)
  File "C:\Python35\lib\site-packages\itoolkit\transport\database.py", line 79, in _call
    return "".join(row[0] for row in cursor).rstrip('\0')
TypeError: 'Cursor' object is not iterable
Exception ignored in: >
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\itoolkit\transport\base.py", line 21, in __del__
  File "C:\Python35\lib\site-packages\itoolkit\transport\base.py", line 69, in close
  File "C:\Python35\lib\site-packages\itoolkit\transport\database.py", line 82, in _close
  File "C:\Python35\lib\site-packages\jaydebeapi\__init__.py", line 437, in close
jpype._core.JVMNotRunning: Java Virtual Machine is not running

To eliminate the errors I changed the lines from the source file itoolkit\transport\database.py as follows
For the error 'Cursor' object is not iterable I changed in the _call method the line 79
from

        return "".join(row[0] for row in cursor).rstrip('\0')

to

        return "".join(row[0] for row in cursor.fetchall()).rstrip('\0')

For the other error I changed in the _close method the line 82
from

        self.conn.close()

to

        try:
          self.conn.close()
        except:
          pass

Now JayDeBeApi works with itoolkit without errors.
I tested my changes with pyodbc too and it works as well as before (without changes).
Is it possible to include these changes in itoolkit so that the database transport also works with JayDeBeApi?

Attached is the original file and the file with proposed changes.
database_transport_changes.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions