oracle11g客户端,cx-oracle6.1安装好之后报错:
1.oci.dll is not the correct architecture
原因是64位系统安装了32位的oracle11g客户端,当时是为了使用plsql,因为plsql只有32位,。重新下载了oracle11g 64位客户端,并在环境变量中配置好路径。
2.继续报错
django.db.utils.DatabaseError: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
原因是在配置django的setting.py的数据库连接时候按着一下方式配置,一下方式的NAME是要求SID不是SERVICE_NAME
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'myservice',
'USER': 'system',
'PASSWORD': 'admin123',
'HOST': '192.168.1.45',
'PORT': '1699',
}
改为支持SERVICE_NAME的配置方式,
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'host.db.com:1699/oracle_service.db.com',
'USER': 'user',
'PASSWORD': 'pass',
}
3.继续报错
'cx_Oracle.Cursor' object has no attribute 'numbersAsStrings'
原因是cx_oracle6.1版本没有numbersAsStrings属性了,降低cx_oracle版本至5.2
测试:
from django.db import connection cursor = connection.cursor()
没报错则成功;
相关资源连接:
https://download.csdn.net/download/houzixuena/10713190