War_Archer
War_Archer

Reputation: 21

Python jaydebeapi Class com.sybase.jdbc4.jdbc.SybDriver not found

I'm trying to connect to the IBM OMNIBUS objectserver DB using Jconn4 and jaydebeapi package, however I keep getting

jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.sybase.jdbc4.jdbc.SybDriver not found

I've tried moving the jconn4.jar to where java is installed and changing the path in the code

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()

My output looks like

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

Upvotes: 1

Views: 2625

Answers (1)

Vic Olvera
Vic Olvera

Reputation: 139

I believe the connect function arguments are: classname, URL, args, jar path.

You could try:

conn = jaydebeapi.connect('com.sybase.jdbc4.jdbc.SybDriver', 'jdbc:sybase:Tds:ip:4100/alerts', {'user': 'user', 'password': 'pass'}, '/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/lib/jconn4.jar')

Upvotes: 0

Related Questions