Trying to connect to a db but getting error:
conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
jdbc:oracle:thin:@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?
On Windows backslashes in path's have to be escaped or you can use raw strings:
conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
jdbc:oracle:thin:@mydomain.com:1234:GP1', [ 'user', 'pass'],
r'C:\Program Files\Java\jdk1.8.0_121\ojdb6.jar')
Alternatively you can set the environment variable CLASSPATH
as described in the JDK docs.