Python cx_Oracle连接错误......附加错误

时间:2018-08-30 13:19:25

标签: python

附加所生成的错误。...请提供帮助

*** Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32. ***
*** Remote Python engine  is active ***
>>> 
*** Remote Interpreter Reinitialized  ***
>>> 
Traceback (most recent call last):
  File "J:\CODE\MINI\SignIn.py", line 24, in loginCheck
    con=cx_Oracle.connect('system/oracle@localhost:1521/xe')
cx_Oracle.DatabaseError: DPI-1050: Oracle Client library must be at version 11.2 or higher
Exit code:  0
>>> 

1 个答案:

答案 0 :(得分:0)

尝试在Windows上通过ODBC设置连接-再次确保您安装了与Oracle安装相匹配的正确的Oracle Instant Client版本。

import cx_Oracle

def myDbTest():                                
  dsn_odbc = cx_Oracle.makedsn("localhost", 1521, "xe")
  conn = cx_Oracle.connect(user="yourusername", password="yourpassword", dsn=dsn_odbc)
  cursor = conn.cursor()
  query = "select * from whatever" 
  return cursor.execute(query)