我正在尝试使用 Jconn4 和 jaydebeapi 包连接到 IBM OMNIBUS 对象服务器数据库,但是我不断收到
jpype._jexception.RuntimeExceptionPyRaisable:java.lang.RuntimeException:找不到类 com.sybase.jdbc4.jdbc.SybDriver
我尝试将 jconn4.jar 移动到安装 java 的位置并更改代码中的路径
import jaydebeapi
import os
import jpype
conn = jaydebeapi.connect('com.sybase.jdbc4.jdbc.SybDriver', ['jdbc:sybase:Tds:ip:4100/alerts','user','pass'],['/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/lib/jconn4.jar'])
curs = conn.cursor()
我的输出看起来像
Traceback (most recent call last):
File "test.py", line 4, in <module>
conn = jaydebeapi.connect('com.sybase.jdbc4.jdbc.SybDriver', ['jdbc:sybase:Tds:ip:4100/alerts','user','pass'],['/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/lib/jconn4.jar'])
File "/usr/lib/python2.7/site-packages/jaydebeapi/__init__.py", line 381, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/usr/lib/python2.7/site-packages/jaydebeapi/__init__.py", line 190, in _jdbc_connect_jpype
jpype.JClass(jclassname)
File "/usr/lib64/python2.7/site-packages/jpype/_jclass.py", line 73, in JClass
raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.sybase.jdbc4.jdbc.SybDriver not found