jython sample for using database
# -*- coding: utf-8 -*-
from com.ziclix.python.sql import zxJDBC
import commands
def main():
commands.getoutput('set CLASSPATH=D:\\09_Workspace\\Develop-lib\\MySQL\\JDBC\\5.1.5\\mysql-connector-java-5.1.5-bin.jar;%CLASSPATH%')
d, u, p, v = "jdbc:mysql://localhost:3306/meals?useUnicode=yes&characterEncoding=UTF-8", 'mealadmin', 'mealadmin123', "org.gjt.mm.mysql.Driver"
db = zxJDBC.connect(d, u, p, v)
c = db.cursor(1) # this gets a dynamic cursor
c.execute("select id_no, login_id, login_pwd from tb_fd_user")
print c.description
for aa in c.fetchall():
print aa
print aa[1].encode('utf-8')
c.close()
db.close()
main()