简体   繁体   English

在tomcat的jython下运行cx_Oracle

[英]Running cx_Oracle under jython on tomcat

I'm trying to load cx_Oracle using tomcat. 我正在尝试使用tomcat加载cx_Oracle。

Loading from python works fine, but for jython I'm getting "module not found". 从python加载工作正常,但是对于jython,我得到“找不到模块”。 My system.path includes site-packages that contains cx_Oracle.so. 我的system.path包含包含cx_Oracle.so的站点程序包。

I'm new to jython and I've not had time to familiarize myself with all the variables but I believe I have all the necessary environment variables exported, though clearly something is amiss. 我是jython的新手,我没有时间熟悉所有变量,但是我相信我已经导出了所有必需的环境变量,尽管显然有些不对劲。

Ben, not all modules that work with Python in CPython implementation will work on other implementations. Ben,并不是所有在CPython实现中与Python一起工作的模块都可以在其他实现中工作。 If such module use system specific calls, or binds to some .dll/.so file it will not work on other Python implementation. 如果此类模块使用系统特定的调用,或绑定到某个.dll / .so文件,则它将不适用于其他Python实现。 cx_Oracle is one os such modules: it binds to Oracle client (there are cx_Oracle versions for various Oracle versions and various operational systems). cx_Oracle是此类操作系统之一:它绑定到Oracle客户端(各种Oracle版本和各种操作系统都有cx_Oracle版本)。

I think you should use JDBC driver if you want to access Oracle from Jython. 我想如果要从Jython访问Oracle,则应该使用JDBC驱动程序。 Then you can use JDBC calls, or use zxJDBC Jython module that makes JDBC drivers available via DB API calls. 然后,您可以使用JDBC调用,或使用zxJDBC Jython模块通过DB API调用使JDBC驱动程序可用。 I used both JDBC (with zxJDBC ) and cx_Oracle in programs that can work from CPython and Jython. 我在可从CPython和Jython运行的程序中同时使用了JDBC(带有zxJDBC )和cx_Oracle。 To see it in action look to my recipe to dump Oracle db schema to text 要查看它的实际效果,请查看我的配方以将Oracle数据库模式转储为文本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM