标签:
参考链接:http://www.cnblogs.com/qiongmiaoer/archive/2013/09/30/3346984.html
psyCope官方文档:http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries
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
标签:
原文地址:http://www.cnblogs.com/IDomyself/p/4795002.html