开发者

sqlite3 module for Jython

I'm using Java Scripting API to execute some external Python scripts from my Java application. The python scripts use sqlite3 module. Execution of the application is resulting in error

ImportError: No module named sqlite3

As I look into the Lib directory(which is in the classpath) of Jython, there's no sqlite3 module. Hence, my search beg开发者_JS百科ins and I found one _sqlite3.py file which is an implementation of javasqlite (http://bugs.jython.org/issue1682864). It's use produced more similar kind of errors.

Then I searched the original python's sqlite3 package(original directory) from the python's standard library location and placed it in the Jython's Lib folder. It then could not find imported _sqlite module which is the _sqlite.so library (actual C implementation).

So, now I need help.


I don't believe there is any way to use a CPython extension in Jython, so you're out of luck there.

There's a Java wrapper for SQLite here: http://www.zentus.com/sqlitejdbc/ This is not going to work quite like a Python database driver, so using it would require some adaptation.

Not fun, but perhaps you (or someone else) could write some Jython around it to produce a drop-in replacement for the sqlite3 module.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜