[Python] Driver not found connecting to oracle DB with jaydebeapi

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    Trying to connect to a db but getting error:

    conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
    jdbc:eek:racle:thin:mad:mydomain.com:1234:GP1', [ 'user', 'pass'],
    'C:\Program Files\Java\jdk1.8.0_121\ojdb6.jar')


    Gives the error

    File "C:\Anaconda2\Lib\site-packages\jpype\_jclass.py", line 55, in JClass
    raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)

    java.lang.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class
    oracle.jdbc.driver.OracleDriver not found


    My JAVA_HOME variable is set to C:\Program Files\Java\jdk1.8.0_121, and in that directory I have the ojdb6.jar file, but I think that I am not correctly managing to set the CLASSPATH correctly. How do I do this?, and to what should I set it?

    Have tried the instructions here but think I am not doing correctly. https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html e.g.

    set CLASSPATH C:\Program Files\Java\jdk1.8.0_121 However when I commandline echo %CLASSPATH% it just comes back with %CLASSPATH% suggesting I have not done it right? Or is there something else the problem?

    Continue reading...

Compartilhe esta Página