使用cx_Oracle操作oracle数据库
简单的使用流程
①.引用模块cx_Oracle
②.连接数据库
③.获取cursor
④.使用cursor进行各种操作
⑤.关闭cursor
⑥.关闭连接
import cx_Oracle
cx_Oracle.connect("用户名 / 密码@ Oracle服务器IP / Oracle的SERVICE_NAME") #连接数据库
c=conn.cursor() #获取cursor
x=c.execute('select sysdate from dual') #使用cursor进行各种操作
x.fetchone()
c.close() #关闭cursor
conn.close() #关闭连接