使用cx_Oracle操作oracle数据库

1.使用cx_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() #关闭连接
 
posted @ 2022-06-16 06:35  我不知道取什么名字好  阅读(71)  评论(0编辑  收藏  举报