首页 > 代码库 > oracle python

oracle python

#!/usr/bin/python

import csv

import cx_Oracle

tns_name = cx_Oracle.makedsn(‘192.168.1.230‘,‘1521‘,‘hfpboc‘)

db = cx_Oracle.connect(‘hfpboc‘,‘hfpboc‘,tns_name)

cursor = db.cursor()

f = open("cardacc.csv","w")

writer = csv.writer(f,lineterminator="\n",quoting=csv.QUOTE_NONNUMERIC)

r = cursor.execute("SELECT * FROM t_inf_card_act")

for row in cursor:

    writer.writerow(row)

f.close()


oracle python