我正在研究 AWS Glue Python Shell。我想将 python shell 与 Oracle 连接。我成功安装了 psycopg2 和 mysql 库,但是当我尝试使用 cx_Oracle 连接 Oracle 时,我已成功安装该库,但遇到错误
数据库错误:DPI-1047:无法找到 64 位 Oracle 客户端库:“libclntsh.so:无法打开共享对象文件:没有这样的文件或目录”
我尝试过以下事情
我已经so从 S3 下载了文件并将其与代码文件并行放置在 lib 文件夹中
我已经使用 os.environ 设置了 LD_LIBRARY_PATH、ORACLE_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 …Run Code Online (Sandbox Code Playgroud)