Connecting to Oracle RDS

前端 未结 2 1320
野趣味
野趣味 2020-12-18 07:50

I am trying to connect to Oracle using AWS lambda and python.

These are the step I followed. (Everything has done EC2 instance)

  1. Downloaded the instantc
相关标签:
2条回答
  • 2020-12-18 08:04

    This post was much helpful for me to use cx_Oracle using Lambda functions. It worked as expected. Thanks for creating this post @Sayed Zainul Abideen

    But i got another error from lambda stating 'cx_Oracle.DatabaseError: ORA-24454: client host name is not set'

    I got it resolved by adding the below lines in my python code:

    import os
    
    with open('/tmp/HOSTALIASES', 'w') as hosts_file:
        hosts_file.write('{} localhost\n'.format(os.uname()[1]))
    

    After which i added below ENVIRONMENTAL VARIABLE to my Lambda function:

    HOSTALIASES = /tmp/HOSTALIASES
    

    Hope it helps somebody.

    Please add comments if any issues relating to cx_Oracle. I would be happy to help as i struggled a lot to fix this.

    0 讨论(0)
  • 2020-12-18 08:06

    I solved this by simply zipping the files properly with the symbolic links

    First I created three symbolic links (with respect to above dir structure):

    ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so.1

    ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so

    ln -s ./lib/libaio.so.1.0.1 ./libaio.so.1.0.1

    ln -s ./lib/libclntsh.so.12.1 ./lib/libclntsh.so

    then i was zipping it incorretly I did it like this:

    zip --symlinks -r9 ~/lamda.zip *

    it worked! properly then.Hope it helps somebody.

    0 讨论(0)
提交回复
热议问题