How to have more informations about a crash when launching a python script

I have a program that use a module ( JayDeBeApi), which crash silently after the instruction: jaydebeapi.connect()
I don’t have any error, any information of what is wrong.
I don’t have more information even after trying to encapsulate the instruction in try: except.

So I wonder, is this a way to launch my script in python for having more logging information, a crash dump, or other things that could help me understand the origin of the problem?

You could have a look at GitHub - 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. to see if there is something you need to do.
But i notice that not PRs gave been processed in the last three years.
Project look abandoned.

1 Like

The fact that there is no Python stack trace implies it is low-level issue somewhere in the Python-Java interface – outside of Python itself. You will not be able to get a picture of what is going on just by running Python. If you have a core dump, you’d be able to load that in a debugger (gdb, lldb). Otherwise, you could add a breakpoint() just before the connection call, which will open Pdb, then attach a low-level debugger too (gdb, lldb, Visual Studio), and try to step into the low-level code – not a fun exercise and probably not very useful since it’s 3d party code.

If the project is abandoned, it would flee it as fast as possible.

It seems that nothing else exists for opening a jdbc connection and launching SQL instructions with Python, so I think I’m stucked :slightly_frowning_face:

I’ve never worked with JDBC drivers so don’t know what’s around, but what you’re saying is extremely unlikely. Off the top of my head I would suggest:

  • Look at Jython (this may already have something ready-made builtin), if you’re able to use Jython.
  • Look at SqlAlchemy which supports various drivers and protocols, sometimes built-in, sometimes as extra sqlalchemy specific Python package.

I did a 5-second search and already saw several promising leads. Look for instance at the PyCharm docs. (Even if you don’t use PyCharm it can suggest what you could use).

Before looking for sth new, however, I would first verify that the connection problem is not caused by an incorrect configuration on your side, permissions problems, or problems with the DB. I took a quick look at the jadebeapi code and that seems to be just a very thin wrapper around other libraries, so I suspect there is nothing wrong as such with the jadebeapi layer.

Also, you might ask yourself why are you using a jdbc connection at all? Is there no other way to connect to the DB?