输入banner图图片脚本导航/分类

python 连接PostgrepSQL

1.python 连接PostgrepSQL的接口:psyCopg

1 conn = psycopg2.connect(database="platoon", user="postgres", password="postgres", host="192.168.10.80", port="5432")
2 cur = conn.cursor()

(1)接口连接的参数:数据库名字,用户名,密码,主机,端口

(2)生成一个游标(暂且这样叫,我还不大清楚)

(3)cur.execute():执行SQL语句

(4)cur.fetchall()

(5) conn.commit()

(6)conn.close()


更好的参考链接: http://www.yiibai.com/html/postgresql/2013/080998.html

 

python 连接PostgrepSQL

标签: