Amazon Python 2.7 Lambda:DPI-1047:无法加载64位Oracle客户端库: [英] Amazon Python 2.7 Lambda: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so"

查看:145
本文介绍了Amazon Python 2.7 Lambda:DPI-1047:无法加载64位Oracle客户端库:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本文与我所经历的最接近:使用Python使用AWS Lambda连接到Oracle RDS .但是,按照所有步骤操作后,我无法获得成功的结果.

This article was the closest to what I experienced: Connecting to Oracle RDS using AWS Lambda using Python. However, after following all of the steps, I am unable to get a successful result.

在us-west-2中踩ami-aa5ebdd2:

Steps on ami-aa5ebdd2 in us-west-2:

sudo yum -y install gcc
mkdir oracle_connect
source oracle_connect/bin/activate
virtualenv oracle_connect
pip install cx_Oracle
wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.2.0.1.0.zip
mv instantclient_12_2/* oracle_connect/lib/
cd oracle_connect
vi test.py # insert python code here
cp /lib64/libaio.so.1.0.1 lib
ln -s ./lib/libclntsh.so.12.1 ./lib/libclntsh.so
ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so.1
ln -s ./lib/libaio.so.1.0.1 ./libaio.so.1.0.1
ln -s ./lib/libaio.so.1.0.1 ./libaio.so.1.0.1
cd lib/python2.7/site-packages/
zip -r ~/oracle_connect.zip * .*
cd ~/oracle_connect/lib64/python2.7/site-packages/
zip -r ~/oracle_connect.zip * .*
cd ~/oracle_connect
zip --symlinks -r9 ~/oracle_connect.zip lib/*
zip ~/oracle_connect.zip test.py

测试代码只是lambda处理程序中的cx_Oracle.connect(connection_string).

The test code is just a cx_Oracle.connect(connection_string) within a lambda handler.

有什么建议吗?我试图提供尽可能多的细节.当我尝试在本地运行此程序时,只有在进行以下设置后,它才能起作用: 导出LD_LIBRARY_PATH =/home/ec2-user/oracle_connect/lib

Any advice? I tried to give as much detail as possible. When I try to run this locally, it won't work until I setup: export LD_LIBRARY_PATH=/home/ec2-user/oracle_connect/lib

因此,我在lambda上将环境变量设置为: LD_LIBRARY_PATH:/var/task/lib

So I setup the environmental variable on the lambda as: LD_LIBRARY_PATH: /var/task/lib

推荐答案

所以我终于使它工作了.我从Oracle重新下载了Instantclient-basic-linux.x64-12.2.0.1.0.zip: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html .我将文件复制到〜/oracle_connect/lib文件夹中.我将符号链接更改为/var/task/lib/(filename)而不是相对路径,并删除了lambda环境变量.现在一切正常.

So I finally got it working. I re-downloaded the instantclient-basic-linux.x64-12.2.0.1.0.zip from Oracle: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html. I copied the files into the ~/oracle_connect/lib folder. I changed my symlinks to /var/task/lib/(filename) instead of the relative path, and removed the lambda environment variables. Everything works now.

这篇关于Amazon Python 2.7 Lambda:DPI-1047:无法加载64位Oracle客户端库:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆