title: Connecting to Oracle RDS
body: <p>I am trying to connect to Oracle using AWS lambda and python.</p>
  
  <p>These are the step I followed. (Everything has done EC2 instance)</p>
  
  <ol>
  <li>Downloaded the instantclient-basic-linux.x64-12.2.0.1.0.zip and<br>
  instantclient-sdk-linux.x64-12.2.0.1.0.zip</li>
  <li>Created this folder structure <code>~/lambda/lib/</code></li>
  <li>Extracted the <code>zip</code> files in the <code>~/lambda/lib/</code></li>
  <li>copied the <code>libaio.so.1.0.1</code> from <code>/lib64/</code> into <code>~/lambda/lib/</code></li>
  <li>Created symbolic link of <code>libaio.so.1.0.1</code> as <code>libaio.so</code> in <code>~/lambda</code></li>
  <li>using pip installed <code>cx_Oracle</code> in <code>~/lambda</code></li>
  <li>written below <code>index.py</code> script in <code>~lambda</code></li>
  </ol>
  
  <p>`</p>
  
  <pre><code>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}
  </code></pre>
  
  <p>`</p>
  
  <ol start="8">
  <li>Then zipped it using <code>zip -r9 ~/upload.zip *</code></li>
  </ol>
  
  <p>After running the code on AWS lambda it gives the following error.</p>
  
  <p><code>Error while trying to retrieve text for error ORA-01804</code></p>
  
  <p>I tried setting ENV ORACLE_HOME=/var/task and /var/task/lib but did not worked </p>
  
  <p>I looked below answers but did not find help yet</p>
  
  <p><a href="https://stackoverflow.com/questions/12560925/error-while-trying-to-retrieve-text-for-error-ora-01019">Error while trying to retrieve text for error ORA-01019</a></p>
  
  <p><a href="https://stackoverflow.com/questions/23060594/oracle-with-node-oracle-error-while-trying-to-retrieve-text-for-error-ora-01804">Oracle with node-oracle: Error while trying to retrieve text for error ORA-01804</a></p>