时间:2021-07-01 10:21:17 帮助过:22人阅读
这里使用python链接Oracle数据库需要引用cx_Oracle库
#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程序设计有所帮助。