python3+jaydebeapi3访问MySQL7

import jaydebeapi

driver='com.mysql.jdbc.Driver'
jarFile=r'C:\Users\ccxpt\.PyCharm2019.2\config\jdbc-drivers\MySQL Connector\J 8\8.0.15\mysql-connector-java-8.0.15.jar'
url='jdbc:mysql://192.168.23.1:3307/oadb'
DBUser='root'
DBPwd='123456'
conn=jaydebeapi.connect(driver,[url,DBUser,DBPwd],jarFile)

curs = conn.cursor()
curs.execute('select * from glfmdrsj')
rows = curs.fetchall()
print(rows[1])
curs.close()
conn.close()
posted @ 2020-03-03 21:02  舟山渔夫  阅读(702)  评论(0编辑  收藏  举报