如何解决问题模块' cx_oracle'没有属性'连接?
我正在尝试使用 cx_oracle 连接Oracle RD。为此,我正在使用 python3.9 和 cx_oracle8.3.0 。但是我会遇到问题模块“ cx_oracle”没有属性'Connect'
任何人都可以帮助我解决此问题。
我的代码:
import os
import json
import cx_Oracle
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def lambda_handler(event, context):
message = ""
cursor = None
connection = None
try:
connection = cx_Oracle.connect("myuser", "pwd", "host:port/orcl")
cursor = connection.cursor()
cursor.execute("select * from mytable")
data=cursor.fetchAll()
for row in data:
logging.info(row)
except Exception as e:
message = str(e)
finally:
if cursor:
cursor.close()
if connection:
connection.close()
return {'message' : message}
谢谢!
I'm trying to connect Oracle RDS by using Cx_Oracle. For that I'm using Python3.9 and Cx_Oracle8.3.0. But I am getting issue module 'cx_Oracle' has no attribute 'connect'
Can anyone help me to fix this issue.
My code:
import os
import json
import cx_Oracle
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def lambda_handler(event, context):
message = ""
cursor = None
connection = None
try:
connection = cx_Oracle.connect("myuser", "pwd", "host:port/orcl")
cursor = connection.cursor()
cursor.execute("select * from mytable")
data=cursor.fetchAll()
for row in data:
logging.info(row)
except Exception as e:
message = str(e)
finally:
if cursor:
cursor.close()
if connection:
connection.close()
return {'message' : message}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论