`
chembo
  • 浏览: 923064 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

python操作oracle

阅读更多
首先需要引入cx_Oracle这个模块,下载地址为:
http://cx-oracle.sourceforge.net/
要根据oracle与python版本号和系统类型选择相应的下载,安装也很简单,一直next就可以了。
下面是操作示例:
import cx_Oracle
db = cx_Oracle.connect('username','pw', '192.168.86.17:1521/db')
db.cursor()
#insert,update,delete are the same as the query as following.
#query
cur.execute('select * from users s where s.account_name=\'gg@gg.gg\'')
for row in cur:
    print row
#cur.fetchone()
#cur.fetchmany(10)
#cur.fetchall()
(a,b)=(row[0],row[2])
print a,b
db.close()

附件是一个关于pyhton db的API介绍。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics