且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

指定独立jython的类路径

更新时间:2023-01-10 11:50:08

在我的Windows环境中,我能够运行:

In my Windows environment I was able to run:

java -cp c:\jars\ojdbc6.jar;c:\jython2.5.2\jython.jar org.python.util.jython schema_ora.py 

其中schema_ora.py是我要运行的脚本,该脚本使用Oracle JDBC驱动程序.

where schema_ora.py is a script I want to run which uses Oracle JDBC driver.

我也在Linux上尝试过:

I also tried it on Linux with:

[mn@test-db mn]# export CLASSPATH=/usr/local/jars/ojdbc6.jar; /usr/local/jython2.5.2/bin/jython -J-Xmx4048m schema_ora.py jdbc:oracle:thin:@192.168.19.128:1521:testdb usr passwd

因此可以以这种方式运行脚本.

So it is possible to run script that way.

对于您的问题,也许您无权查看MySQL JDBC驱动程序? 我假设您使用的是Linux,因此您可以检查是否可以看到该文件:

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:

file /tmp/mm.mysql-2.0.14-bin.jar

我在Linux机器上使用Oracle驱动程序进行了尝试:

I tried it with Oracle driver on my Linux box:

[mn@test-db mn]# file /usr/local/jars/ojdbc6.jar
/usr/local/jars/ojdbc6.jar: Zip archive data, at least v2.0 to extract