Hi all,

I have a problem with jython and zxJDBC, here my output:

skippa@nawab:~/master/bin$ java -jar ../lib/jython.jar
Jython 2.5.2rc2 (Release_2_5_2rc2:7167, Oct 24 2010, 22:48:30)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
skippa@nawab:~/master/bin$ java -jar ../lib/jython.jar ./test.py
Traceback (most recent call last):
  File "./test.py", line 12, in <module>
    driver = "com.mysql.jdbc.driver"
zxJDBC.DatabaseError: driver [com.mysql.jdbc.driver] not found
skippa@nawab:~/master/bin$ ls $CLASSPATH
/home/bude2/skippa/master/lib/mysql-connector-java-5.1.13-bin.jar

test.py:

from __future__ import with_statement
from com.ziclix.python.sql import zxJDBC
import os, sys
sys.path.append(os.environ['MASTER_HOME'] + "/conf")
sys.path.append(os.environ['MASTER_HOME'] + "/lib/mysql-connector-java-5.1.13-bin.jar")

import myconfig

jdbc_url = "jdbc:mysql://" + "hostname" + ":3306"
driver = "com.mysql.jdbc.driver"

with zxJDBC.connect(jdbc_url, myconfig.dbmusername, myconfig.dbmpassword, driver) as conn:
    with conn:
        with conn.cursor() as c:
           c.execute("show tables;")
           c.fetchone()

So, I am confused, jython / zxJDBC can't find the mysql driver and I don't know why.

Thank you very much.

Best regards,

Alexander