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
364 stars 147 forks source link

No JVM shared library file (libjvm.so) found. Try setting up the JAVA_HOME environment variable properly. #237

Open marcelomachado opened 9 months ago

marcelomachado commented 9 months ago

I am trying to use JayDeBeApi in a docker container based on a DockerHub Python image (python 3.9.18). However, whenever i try to connect to a database I get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 412, in connect
    jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
  File "/usr/local/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 184, in _jdbc_connect_jpype
    jvm_path = jpype.getDefaultJVMPath()
  File "/usr/local/lib/python3.9/site-packages/jpype/_jvmfinder.py", line 74, in getDefaultJVMPath
    return finder.get_jvm_path()
  File "/usr/local/lib/python3.9/site-packages/jpype/_jvmfinder.py", line 212, in get_jvm_path
    raise JVMNotFoundException("No JVM shared library file ({0}) "
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (libjvm.so) found. Try setting up the JAVA_HOME environment variable properly.

I can't use this lib without having to install java?

tejasviSri commented 4 months ago

Hi @marcelomachado did you have any luck in solving this? I'm facing the same issue on python 3.11