I am trying to connect to Oracle using AWS lambda and python.
These are the step I followed. (Everything has done EC2 instance)
- Downloaded the instantclient-basic-linux.x64-12.2.0.1.0.zip and
instantclient-sdk-linux.x64-12.2.0.1.0.zip
- Created this folder structure
~/lambda/lib/
- Extracted the
zip
files in the ~/lambda/lib/
- copied the
libaio.so.1.0.1
from /lib64/
into ~/lambda/lib/
- Created symbolic link of
libaio.so.1.0.1
as libaio.so
in ~/lambda
- using pip installed
cx_Oracle
in ~/lambda
- written below
index.py
script in ~lambda
`
import cx_Oracle
def handler(event, context):
message = ""
cursor = None
connection = None
try:
connection = cx_Oracle.connect("USERNAME", "PASSWORD", "DOMAIN/orcl")
cursor = connection.cursor()
cursor.execute("""QUERY""")
except Exception as e:
message += " {Error in connection} " + str(e)
finally:
if cursor:
cursor.close()
if connection:
connection.close()
return {'message' : message}
`
- Then zipped it using
zip -r9 ~/upload.zip *
After running the code on AWS lambda it gives the following error.
Error while trying to retrieve text for error ORA-01804
I tried setting ENV ORACLE_HOME=/var/task and /var/task/lib but did not worked
I looked below answers but did not find help yet
Error while trying to retrieve text for error ORA-01019
Oracle with node-oracle: Error while trying to retrieve text for error ORA-01804
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…