Jep 3.1 Released
6/10/2012I have just released Jep 3.1 on PyPi. Get it now: pip install jep
.
New in this release is an improved import hook that can lazy-load Java packages. This fixes an issue on some JREs where it is not possible to reflect all packages.
Also, I put a lot of work into a DBAPI-2 module that wraps JDBC drivers in Java. This makes it possible to use the very nice, platform independent database drivers from Python. This is my solution to the Teradata driver problem.
Here's an example shell session, which starts from installing Jep to an example using the sqlite JDBC driver:
$ pip install jep
[output snipped]
Successfully installed jep
Cleaning up...
Launch the jep
shell script, a shortcut to launching Java and executing
a provided console script. It is also possible to set the CLASSPATH
environment variable to add 3rd party libraries:
$ export CLASSPATH=`pwd`/lib/sqlitejdbc-v056.jar
$ jep
Next, make sure the sqlite driver is loaded:
>>> import jep
>>> jep.findClass('org.sqlite.JDBC')
<PyJobject object at 0x10bdddf18>
Finally, connect to a test.db database using a standard JDBC URL:
>>> from jep.jdbc import connect
>>> conn = connect('jdbc:sqlite:test.db')
>>> cursor = conn.cursor()
>>> cursor.execute('select 123, current_timestamp')
>>> row = cursor.fetchone()
>>> row
(123L, '2012-06-10 19:57:22')