ubuntop
超级会员
超级会员
  • 发帖数41
  • QQ88888888
  • 金币421两
  • 威望184点
  • 钻石0枚
  • 注册日期2016-11-11
  • 最后登录2017-11-02
阅读:10976回复:3

Python操作oralce数据库

楼主#
更多 发布于:2016-11-14 09:18
import cx_Oracle
import getpass
import platform
import sys


print("Python version: " + platform.python_version())  #python版本
print("cx_Oracle version:" + cx_Oracle.version)       # cx_Oracle版本
print("Oracle client:" + str(cx_Oracle.clientversion()).replace(', ','.')) #oracle 版本


conn = cx_Oracle.connect('用户名/密码@数据库') #连接数据库
cur1 = conn.cursor()
vsql1=("update xxx set xxx where  xxx) #需要执行的sql


print (vsql1)


cur1.execute(vsql1)  #执行SQL


conn.commit()  #提交


cur1.close()  
conn.close()
喜欢0 评分0
游客

返回顶部