python连接Oracle数据库的代码

2015-11-12 0 371
python连接Oracle数据库的代码

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 python连接Oracle数据库的代码 http://www.ox520.com/15945.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务