I have a basic requirement of connecting an on premise Oracle database to Redshift.
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.
Below are the steps followed to try to connect to Oracle on premise DB :
- Installed cx_Oracle which came up with cx_Oracle.cpython-36m-x86_64-linux-gnu.so and psycopg2-2.7.4.dist-info
- Installed basic oracle client lite 64 bit for linux
- Set LD_LIBRARY_PATH to point to the lib files of the instant client package
When we zip our python file with the dependencies of cx_Oracle and Instant client, AWS Lambda fails with below error :
"DPI-1047: 64-bit Oracle Client library cannot be loaded: \"libclntsh.so: cannot open shared object file: No such file or directory\"
From within your lib folder, do:
ln -s libclntsh.so.12.1 libclntsh.so
(or similar, depending what versions you're using).
来源:https://stackoverflow.com/questions/49124271/aws-lambda-cannot-connect-to-oracle-instant-client