database – Python 3 – Connecting with JDBC

database – Python 3 – Connecting with JDBC

As I can not delete this answer, I will edit it:

Way back when, I created a Python3-port of JayDeBeApi. But as the other answer points out, the official JayDeBeApi now supports Python3 as well.

Starting from version 0.2 the official JayDeBeApi now supports Python 3 as well. It is still backwards compatible with Python 2 and Jython.

database – Python 3 – Connecting with JDBC

Probably too late to be useful, but I was able to connect from Python 3.3 to a MySQL db on my Windows machine (!) using PyMySql (see https://code.google.com/p/pymysql/). Once installed, I used a variation on the code from your reference location here: Python 3 and MySQL. I have a schema called test and a table called users, here was the test code:

import pymysql
conn = pymysql.connect(host=127.0.0.1, user=root, passwd=password, db=mysql)
cur = conn.cursor()
cur.execute(SELECT * FROM test.users)
for r in cur:
    print(r)
cur.close()
conn.close()

Leave a Reply

Your email address will not be published. Required fields are marked *