【发布时间】:2019-12-06 13:46:14
【问题描述】:
如何解决这个错误,我使用python3.6,我使用Oracle数据库11g,我想将我的python连接到oracle数据库,但是显示错误,我该如何解决?
这是我的代码:
#importing module
import cx_Oracle
#create a table in oracle database
try:
con = cx_Oracle.connect('db_employees/root@localhost')
#Now execute the sqlquery
cursor = con.cursor()
cursor.execute("insert into employees values(2171114103970002, raden, ceo, 01031997, batam, 001)")
#commit that insert the provided database
con.commit()
except cx_Oracle.DatabaseError as e:
print("There is a problem with Oracle", e)
#by writing finally if any error occurs
#then also we can close the all database operation
finally:
if cursor:
cursor.close()
if con:
con.close()
这是消息错误:
C:\Python36>python "D:\testing.py"
There is a problem with Oracle DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Traceback (most recent call last):
File "D:\testing.py", line 20, in <module>
if cursor:
NameError: name 'cursor' is not defined
【问题讨论】:
-
请检查您的代码格式。我已经编辑了您的帖子以使其格式清晰
标签: oracle oracle11g python-3.6 cx-oracle