0

I am trying to execute below lambda function from aws lambda, I used python 3.7 as runtime environment.

import cx_Oracle
import os
import logging
import boto3
from botocore.exceptions import ClientError
from base64 import b64decode


logger = logging.getLogger()
logger.setLevel(logging.INFO)

def lambda_handler(event, context):

    logger.info('begin lambda_handler')
    os.environ['LD_LIBRARY_PATH'] = os.getcwd()
    dsn = cx_Oracle.makedsn("hostname", 1521, service_name="servicename")
    con = cx_Oracle.connect("userid", "passwod", dsn)
    cur = con.cursor()

    #logger.info('username: ' + username)
    #logger.info('host: ' + host)

    sql = """SELECT COUNT(*) AS TEST_COUNT FROM DUAL"""

    cur.execute(sql)
    columns = [i[0] for i in cur.description]
    rows = [dict(zip(columns, row)) for row in cur]
    logger.info(rows)

    con.close()
    logger.info('end lambda_handler')
    return "Successfully connected to oracle."

But when i execute above lambda i get below error. Error while trying to retrieve text for error ORA-01804

Any help on this?

Rahul
  • 269
  • 2
  • 10
  • 25
  • Did you check https://stackoverflow.com/questions/12837811/error-while-trying-to-retrieve-text-for-error-ora-01804 – pifor May 28 '20 at 11:04

1 Answers1

0

Check if your Oracle instant version is the same as your database. That can also lead to this error. I tried using the latest oracle instant client v21.1 and it spews the same error like this. It turns out the server that hosts the database is using v11.2 so I had to download the v11.2 to match it.

Karagee
  • 48
  • 5
  • Welcome to Stack Overflow. Please be aware this is not a code-writing or tutoring service. We can help solve specific, technical problems, not open-ended requests for code or advice. Please edit your question to show what you have tried so far, and what specific problem you need help with. See the [How To Ask a Good Question](https://stackoverflow.com/help/how-to-ask) page for details on how to best help us help you. – samthegolden May 28 '21 at 12:40