AWS Lambda无法连接到Oracle Instant Client [英] AWS Lambda cannot connect to Oracle Instant Client
问题描述
我有一个基本要求,将本地Oracle数据库连接到Redshift.
I have a basic requirement of connecting an on premise Oracle database to Redshift.
我需要使用AWS Lambda使用python连接到两个数据库.通过导出psycopg2
的Linux库实现与Redshift的连接时,我遇到了Oracle数据库问题.
I need to use AWS Lambda to connect to both the databases using python. While I achieved connection to Redshift by exporting Linux libraries of psycopg2
, I am facing issues with the Oracle database.
以下是尝试在本地DB上连接到Oracle的步骤:
Below are the steps followed to try to connect to Oracle on premise DB :
- 安装了cx_Oracle,它随cx_Oracle.cpython-36m-x86_64-linux-gnu.so和psycopg2-2.7.4.dist-info一起提供了
- 为Linux安装了基本的Oracle Client Lite 64位
- 设置LD_LIBRARY_PATH指向即时客户端软件包的lib文件
当我们使用cx_Oracle和Instant Client的依赖关系压缩python文件时,AWS Lambda失败并显示以下错误:
When we zip our python file with the dependencies of cx_Oracle and Instant client, AWS Lambda fails with below error :
"DPI-1047:无法加载64位Oracle Client库:\" libclntsh.so:无法打开共享库文件:没有这样的文件或目录\"
"DPI-1047: 64-bit Oracle Client library cannot be loaded: \"libclntsh.so: cannot open shared object file: No such file or directory\"
推荐答案
在您的lib文件夹中,执行以下操作:
From within your lib folder, do:
ln -s libclntsh.so.12.1 libclntsh.so
(或类似名称,具体取决于您所使用的版本).
(or similar, depending what versions you're using).
这篇关于AWS Lambda无法连接到Oracle Instant Client的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!