Python连接gbase数据库

1)安装依赖库

pip install pymysql

2)查询代码

import pymysql.cursors
#连接gbase数据库
connection = pymysql.connect(host='127.0.01', port=5258, user='root', 
                             password='111', db='habo', charset='utf8mb4')                            
cur = connection.cursor();
cur.execute("SELECT * FROM dim_vip limit 10")
for r in cur.fetchall():
    print(r);    
connection.close()
--------------------- 
作者:sunys312 
来源:CSDN 
原文:https://blog.csdn.net/sunys312/article/details/79961614 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/xuq09/article/details/87166955