For the life of me I could not get Jython to recognize my mysql driver using JDBC. I literally spent hours trying to get it to work. Fooling with my classpath, my version of the mysql-connector and my version of Jython. Finally I gave up and wrote a really simple wrapper class.

This is the Error:

#the following line is “print sys.path”
[‘./mysql-connector-java-5.1.6-bin.jar’, ‘/Volumes/UserHome/bcx/work/istuff/iros/jar’, ‘/Volumes/UserHome/bcx/jython2.5a3/Lib’, ‘__classpath__’, ‘/Volumes/UserHome/bcx/jython2.5a3/Lib/site-packages’]
Traceback (most recent call last):
File “”, line 12, in
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: com/mysql/jdbc/Driver

So I dealt with various version of that error for a while. Finally I gave up and wrote a wrapper class, which didn’t work until I downloaded and installed jython 2.5a3, previously I was using the latest stable, 2.2.1.

Here is my quick wrapper class:

import java.sql.*;

public class Connect
public static Connection getConnection(String url, String usr, String pass) throws Exception{
Class.forName (“com.mysql.jdbc.Driver”).newInstance ();
return DriverManager.getConnection(url, usr, pass);

Here is how I used it in my Jython code.

import Connect
import sys

url = “jdbc:mysql://localhost/replay”
con = Connect.getConnection(url,”root”,””) #this line uses my wrapper

stmt = con.createStatement()

In other news I implemented a mDNS enabled mysql-based indexed logger for EventHeap. The next step is to build a simple interface for replaying marked logs. I really wish I could write this interface using a language other than Jython or Java, so the next step will be fooling around with my various options. I am not sure if I am feeling adventurous enough to try out JRuby, but Ruby on Rails would be a nice way to build a really quick web front end. I am leaning towards some sort of Jython based EventHeap RPC server, that has “jobs” which can be started / stopped/ monitored/ and modified over REST or XMLRPC. This shouldn’t be that bad, but I “really” would prefer to do the network code using twisted, although I think the “goal” of this stage, is to pretty much hack this thing together asap.