Database Access with Jython, Hibernate and SQLAlchemy - Oracle
Database Access with Jython, Hibernate and SQLAlchemy - Oracle
Database Access with Jython, Hibernate and SQLAlchemy - Oracle
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Basic Connection<br />
from com.ziclix.python.sql import zxJDBC<br />
try:<br />
cursor = None<br />
db = None<br />
try:<br />
db = zxJDBC.connect("jdbc:mysql://localhost/test",<br />
'user', 'pass', "org.gjt.mm.mysql.Driver")<br />
cursor = db.cursor()<br />
cursor.execute("select name from user")<br />
for row in cursor.fetchall():<br />
print row<br />
finally:<br />
if cursor is not None:<br />
cursor.close()<br />
if db is not None:<br />
db.close()<br />
except Exception, reason:<br />
print reason<br />
2008 JavaOne SM Conference | java.sun.com/javaone | 5