I am trying to run a python script via jython on a server that I won't be able to install anything.
I can run
java -jar jython.jar
and that works fine. I am unable to use mm.mysql-2.0.14 driver because it can't find the jar. I set the classpath to include it, as I did on a test system with a standard (that is, non-standalone) jython install. It still says it can't find the jar.
I have tried things like:
export CLASSPATH=/tmp/mm.mysql-2.0.14-bin.jar:/tmp/zxJDBC.jar;
java -jar jython.jar
and
java -cp /tmp/mm.mysql-2.0.14-bin.jar -jar jython.jar
no dice.
still the error: zxJDBC.DatabaseError: driver [org.gjt.mm.mysql.Driver] not found
From the Java Documentation ...
So it it not possible to add anything to the classpath when using -jar. You'd either have to repackage the jython.jar to include the required classes, or preferably use Michał Niklas' solution of adding the jython.jar to the classpath (either using -cp or CLASSPATH) and running the org.python.util.jython class directly.
In my Windows environment I was able to run:
where
schema_ora.py
is a script I want to run which uses Oracle JDBC driver.I also tried it on Linux with:
So it is possible to run script that way.
As for your problem maybe you do not have rights to see MySQL JDBC driver? I assume you use Linux, so you can check if you can see that file:
I tried it with Oracle driver on my Linux box: