Import Non-standard Python Module In Jython
Solution 1:
jython can import non-standard python modules if they are pure python. database connections are typically cpython modules. For database connectivity, see zxJDBC It makes any jdbc connectivity available to java behave in the standard python DBI 2.0 kind of way.
Best of both worlds!
Solution 2:
Since you are using jython, use the mysql connector/J jar. Download it, add it to your CLASSPATH
, and make sure your user executing the code has read permissions to the location where the jar is.
Once you have the jar, follow the documentation for sample code.
Solution 3:
PyDbLite is ostensibly pure-python, so it should import into jython OK. I've not tried to use a setup.py with Jython, but I've imported several pure-python .py's that didn't ship with Jython, from Jython. I have one project that runs on CPython 2.x, CPython 3.x, Pypy and Jython using the usual import machinery.
The main question that comes to mind is: Is PyDbLite in a directory on your sys.path?
Post a Comment for "Import Non-standard Python Module In Jython"