Python 3 - Connecting Using JDBC

How do you connect to a database using the JDBC driver from Python 3? JayDeBeApi seems to do the job for Python 2, but at the moment it is not compatible with Python 3.

This question is similar to this , but I am specifically asking about Python 3.

+10
source share
3 answers

Since I cannot delete this answer, I will edit it:

In the distant past, I created the Python3 port of JayDeBeApi. But, as another answer indicates, the official JayDeBeApi now also supports Python3.

+7
source

Starting with version 0.2, the official JayDeBeApi now also supports Python 3. It is still backward compatible with Python 2 and Jython.

+5
source

It is probably too late to be useful, but I was able to connect from Python 3.3 to MySQL db on my Windows machine (!) Using PyMySql (see https://code.google.com/p/pymysql/ ). After installation, I used a version of the code from your reference location here: Python 3 and MySQL . I have a diagram called "test" and a table called "users", here is 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() 
0
source

Source: https://habr.com/ru/post/899263/


All Articles