zoukankan      html  css  js  c++  java
  • windows下python连接oracle数据库

       

    python连接oracle数据库的方法,具体如下

    1.首先安装cx_Oracle包
    2.解压instantclient-basic-windows.x64-11.2.0.4.0.zip到c:oracle
    3.拷贝instantclient_11_2下所有.dll文件到c:python34Libsite-packages下(根据自己的python版本拷贝到相应的site-packages文件夹下)

    python连接示例代码:

      

    # -*- coding: utf-8 -*-
    import cx_Oracle
    
    conn=cx_Oracle.connect('reporter','password','localhost:1521/ORCL')
    cursor=conn.cursor()
    sql="select * from test"
    cursor.execute(sql)
    data=cursor.fetchall()
    print(data)
    cursor.close()
    conn.commit()
    conn.close()
    

      

  • 相关阅读:
    服务器搭建Git
    BGP协议详解
    以太坊
    燃 * & *
    UML类图解析
    day8.文件操作
    python面试题汇总
    day5.字典
    day5.类型汇总
    day3,4总结程序
  • 原文地址:https://www.cnblogs.com/68xi/p/11724030.html
Copyright © 2011-2022 走看看