sh连oracle,与Oracle cx的连接AWS Glue Python Sh的Oracle问题

我正在研究AWS胶水pythonshell。我想把pythonshell和Oracle连接起来。我成功地安装了psycopg2和mysql库,但是当我试图使用cx_Oracle连接Oracle时,我已经成功地安装了库,但是我遇到了错误DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library:

"libclntsh.so: cannot open shared object file: No such file or

directory"

我已经试过了我从S3下载了so文件,并将其与代码文件并行地放在lib文件夹中

我已经设置了LD_LIBRARY_路径,ORACLE\u HOME使用操作系统环境

我使用以下代码import boto3

import os

import sys

import site

from setuptools.command import easy_install

s3 = boto3.client('s3')

dir_path = os.path.dirname(os.path.realpath(__file__))

#os.path.dirname(sys.modules['__main__'].__file__)

install_path = os.environ['GLUE_INSTALLATION']

easy_install.main( ["--install-dir", install_path, "cx_Oracle"] )

importlib.reload(site)

import cx_Oracle

conn_str = u'{username}/{password}@{host}:{port}/{sid}'

conn = cx_Oracle.connect(conn_str)

c = conn.cursor()

c.execute(u'select * from hr.countries')

for row in c:

print(row[0], "-", row[1])

conn.close()

print('hello I am here');

我应该能够在aws glue pythonshell上连接oracle

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值