本文实例讲述了python链接Oracle数据库的方法。分享给大家供大家参考。具体如下:
这里使用python链接Oracle数据库需要引用cx_Oracle库
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#coding=UTF-8 import cx_Oracle def hello(): '''Hello cx_Oracle示例: 1)打印数据库版本信息. 2)查询表数据.''' conn = cx_Oracle.connect("obs61","obs61","tx8i.hp") cur = conn.cursor() try: print "Oracle Version:%s" % conn.version print "Table SUB_POLICY rows:" cur.execute('select * from wlan_future_event') for row in cur: print row finally: cur.close() conn.close() hello()
希望本文所述对大家的Python程序设计有所帮助。
最后
以上就是诚心墨镜最近收集整理的关于python链接Oracle数据库的方法的全部内容,更多相关python链接Oracle数据库内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复