zoukankan      html  css  js  c++  java
  • Python连接oracle

    import cx_Oracle
    
    conn = cx_Oracle.connect('用户名/密码@IP/ServiceName') #1个参数
    
    conn = cx_Oracle.connect('用户名', '密码', 'IP/ServiceName') #3个参数

    打开 D:appusernameproduct11.2.0client_1NETWORKADMIN路径下的tnsnames.ora

    此处的IP为下列连接描述的HOST,ServiceName为SERVICE_NAME 

    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 111.111.111.111)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
      )
    )

    刚刚开始连接时,我机器上的oracle是32位客户端连64位服务器端,客户端位于 D:appusernameproduct11.2.0client_1

    尝试连接时,会报错如下:

    cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "d:appsabreproduct11.2.0client_1inoci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows for help

    按照提示中的链接,找到oracle的64位客户端文件package,下载,放到D:instantclient_11_2,然后把这个路径添加到系统path中,再次尝试连接,就可以了。

  • 相关阅读:
    表单元素input与文字对齐
    css hack较全
    闭合浮动
    字体
    css中z-index属性(包含各浏览器对此兼容问题)
    ie中使用滤镜实现css3的效果
    css实现提示框
    css3实现渐变效果
    css伪类
    .net core运用application/x-www-form-urlencoded发起post请求
  • 原文地址:https://www.cnblogs.com/Sabre/p/8044649.html
Copyright © 2011-2022 走看看