python

import cx_Oracle
db = cx_Oracle.connect('hr', 'hrpwd', 'localhost:1521/XE')
#db1 = cx_Oracle.connect('hr/hrpwd@localhost:1521/XE')
# dsn_tns = cx_Oracle.makedsn('localhost', 1521, 'XE')
#print dsn_tns
#db2 = cx_Oracle.connect('hr', 'hrpwd', dsn_tns)
cursor = db.cursor()
print "start"
r = cursor.execute("select ss from MST ")
print "end"
index = 0;
#for row in cursor:
#    index+=1;
#    print index, row
#for cu in cursor.fetchone():
#    print cu;

你可能感兴趣的:(oracle,python,db2)