Python连接Oracle

2016-07-05 0 867
Python连接Oracle

python 3.4.3
cx_Oracle

#!/usr/bin/env python
import time
start = time.clock()

import cx_Oracle
tns = cx_Oracle.makedsn('127.0.0.1', '1534', 'dsn')
db = cx_Oracle.connect('username', 'password', tns)
def sqlSelect(sql, db):
    cur=db.cursor()
    cur.execute(sql)
    result=cur.fetchall()
    cur.close()
    return result

sql_1 = " "
sql_2 = " "
sql_3 = " "

sql_list = [sql_1, sql_2, sql_3]
for sql in sql_list:
    result = sqlSelect(sql, db)
    print(result[0][0])

end = time.clock()  
print("\nRunning time: %f s" % (end - start))

遇见资源网 python Python连接Oracle http://www.ox520.com/16036.html

下一篇:

已经没有下一篇了!

常见问题

相关文章

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

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