Jython, a implementation of Python that uses the Java programming language.
While Jython is Python, and implements the same Python language and
(almost) standard library as CPython, it doesn't implement the CPython C
API, and therefore can't use C-API extensions like MySQLdb. (They're
actually working on a clever wrapper that will change this in the
future, but that doesn't help you today.)
There are other MySQL drivers that work with both CPython and Jython (because they use pure Python), such as
There are other MySQL drivers that work with both CPython and Jython (because they use pure Python), such as
PyMySQL
. But the simplest solution is to just use Java's JDBC
drivers. As the Jython FAQ suggests, the easiest way to do that is:UseUnlike using JDBC directly, usingzxJDBC
which gives data database connectivity from Jython using the Python DB API 2.0 interface…
zxJDBC
often means you only need to change one line in your MySQLdb code to make it work.