python 访问oracle

驱动:cx_oracle(python 2.7+oracle10g)点击打开链接,

http://cx-oracle.sourceforge.net/


示例:

import time
import cx_Oracle

con = cx_Oracle.connect('user/[email protected]/orcl')

start = time.time()

cur = con.cursor()
cur.arraysize = 100
cur.execute('select * from atable')
res = cur.fetchall()

elapsed = (time.time() - start)
print elapsed, " seconds"

cur.close()
con.close()


注:安装cx_Oracle需要注意两点:1.追加$ORACLE_HOME/lib到环境变量LD_LIBRARY_PATH

                                                            2.关闭selinux



你可能感兴趣的:(python 访问oracle)